Trying to run a script from: Git blame: statistics which is supposed to:
To give me a statistic of how much lines (of code) are currently in the repository originating from each committer.
Specifically:
git ls-tree -r -z --name-only HEAD -- /.c | xargs -0 -n1 git blame \ --line-porcelain HEAD |grep "^author "|sort|uniq -c|sort -nr
I am getting the following error and can't understand why:
cannot stat path 'HEAD': No such file or directory when running when running git blame script
Please note I am using git bash
and not an actual linux system. Could this be making the difference?
Update
Apparently the command I am running is not identical. I just copied and pasted the command again:
git ls-tree -r -z --name-only HEAD -- */*.c | xargs -0 -n1 git blame \
--line-porcelain HEAD |grep "^author "|sort|uniq -c|sort -nr
Update2
So the problem specifically seems to be related to -- */*.c
.
The original command suggested by the accepted answer works correctly:
git ls-tree --name-only -z -r HEAD|egrep -z -Z -E '\.(java)$' \
> |xargs -0 -n1 git blame --line-porcelain|grep "^author "|sort|uniq -c|sort -nr