The number of lines of code obtained by git log and gitlab api is very different

The git api is fetched this way:

curl --header “PRIVATE-TOKEN: <your_access_token>” “https://gitlab.example.com/api/v4/projects/5/repository/commits/master

The git log is fetched this way:

$ git log --author=“$(git config --get user.name)” --pretty=tformat: --numstat | gawk ‘{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf “added lines: %s removed lines : %s total lines: %s\n”,add,subs,loc }’ -

The different is :

If this file ‘package-lock.json’ is include , git api will count the number of lines of code, but git log will not count it, but treat it as a binary file.

企业微信截图_16890564636966