I want to track the number of additions and deletions that exclude moved lines. So if a commit has 10 additions, 5 deletions, and 3 moved lines, then I have 7 additions, 2 deletions excluding moved lines. The 10 and 5 are given by the following code. I need to generate the 3 (I only need weak moved line detection, e.g. any line that appears identically as simultaneously deleted from one location and added to another location within the same commit).
I am using the following to track number of additions and deletions for an important file in my git repository.
git log --since=2014-08-01 --date=short --pretty=format:"%ad%x09" --numstat -- file.tex
This yields the following, where the first number is additions and the second number is deletions.
2014-08-19 72 0 file.tex 2014-08-19 211 290 file.tex ...
I want to add a third column, call it moved lines. The moved lines per commit can be found by doing the following in a loop for every commit:
- Grep changeset for lines starting with + or -
- Strip leading + or -
Is there an fast and elegant way to run this pseudocode or do I just need to dump and parse a bunch of full git diffs to get what I need?