This is the result of my latest commit / change in Git...
...and in Gerrit:
Is there any explanation for difference in number of lines added and deleted? Different algorithm?
The actual changes are same. But the difference is due to how GIT and GERRIT computes the number of lines changed. Say you have 4 versions/changes/patchsets of the commit on top of HEAD.
commit_patchset#4
commit_patchset#3
commit_patchset#2
commit_patchset#1
HEAD
Git:
Number of lines changed for commit#4(A1): diff between commit_patchset#4 and commit_patch#3
Number of lines changed for commit#3(B1): diff between commit_patchset#3 and commit_patch#2
Number of lines changed for commit#2(C1): diff between commit_patchset#2 and commit_patch#1
Number of lines changed for commit#1(D1): diff between commit_patchset#1 and HEAD
Gerrit:
Number of lines changed for commit#4(A2): diff between commit_patchset#4 and BASE/HEAD
Number of lines changed for commit#3(B2): diff between commit_patchset#3 and BASE/HEAD
Number of lines changed for commit#2(C2): diff between commit_patchset#2 and BASE/HEAD
Number of lines changed for commit#1(D2): diff between commit_patchset#1 and BASE/HEAD
So always the number of lines changed will be different.
You can ask Gerrit to show the exact difference (as GIT shows) between patchset version instead of BASE/HEAD using ".." option.
For example,
http://your_gerrit_url/your_change_id/4..3 gives you the exact lines changed between commit_patchset#4 and commit_patchset#3. This should match the GIT calculations.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With