{"thread":{"id":"20529","subject":"blame -M vs. log -p|grep -c ^+ weirdness","startedAt":"2009-08-11T10:16:00Z","lastAt":"2009-08-11T11:56:04Z","messageCount":2,"participants":["Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"120222","messageId":"200908111216.05131.trast@student.ethz.ch","threadId":"20529","inReplyTo":null,"subject":"blame -M vs. log -p|grep -c ^+ weirdness","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-08-11T10:16:00Z","receivedAt":"2009-08-11T10:16:00Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Hi all\n\nI think I'm fundamentally misunderstanding something about the blame\ncode...  The other day I wanted to see how much our local fork of\nDOMjudge diverged from their upstream.  You can grab the entire\nhistory at\n\n  git://csa.inf.ethz.ch/domjudge-public.git\n\nif you want to try the commands I ran.\n\nAs a first statistic I looked at how many lines are blamed to our\nlocal team (Christoph, Florian and me) by running\n\n  git ls-files | while read f; do git blame -M -- \"$f\"; done |\n  perl -pe 's/^\\^?[a-f0-9]* (?:[^(]* )?\\(([^2]*?) *20.*/$1/' |\n  sort | uniq -c | sort -n\n\nThis shows that over 8000 lines are attributed to the three of us:\n\n      1 domjudge                                                                   \n      2 rob                                                                        \n    113 Stijn van Drongelen                                                        \n    126 Jeroen Schot                                                               \n    149 neus                                                                       \n    866 Peter van de Werken                                                        \n   1245 Thomas Rast                                                                \n   1752 Christoph Krautz                                                           \n   5350 Florian Jug                                                                \n  10293 Thijs Kinkhorst                                                            \n  20397 Jaap Eldering   \n\nHowever, sanity checking this against the diffs of the single commits\nshows quite a different number:\n\n  git log --no-merges -p upstream/2.2.. | grep '^+' | grep -v -c '^+++'\n\ngives only 4943 '+' lines, and you can easily verify with\n\n  git shortlog -sn upstream/2.2..\n\nthat indeed all commits in that range are ours.  So why does the blame\nthink more lines are ours than we even added *in total*?\n\nBjörn Steinbrink suggested on IRC that I use -M5 -C5 -C5 -C5, which\nindeed reduces it to\n\n      1 domjudge                                                                   \n      2 rob                                                                        \n    115 Stijn van Drongelen                                                        \n    116 Jeroen Schot                                                               \n    149 neus                                                                       \n    390 Florian Jug                                                                \n    930 Peter van de Werken                                                        \n   1209 Thomas Rast                                                                \n   1612 Christoph Krautz                                                           \n  11750 Thijs Kinkhorst                                                            \n  24020 Jaap Eldering\n\nNote especially the huge drop in Florian's numbers.  What's going on\nhere?\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"120226","messageId":"200908111356.06558.trast@student.ethz.ch","threadId":"20529","inReplyTo":"200908111216.05131.trast@student.ethz.ch","subject":"Re: blame -M vs. log -p|grep -c ^+ weirdness","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2009-08-11T11:56:04Z","receivedAt":"2009-08-11T11:56:04Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Thomas Rast wrote:\n>   git://csa.inf.ethz.ch/domjudge-public.git\n\nTurns out this is locked down from the outside as of this writing, so\nI mirrored it at\n\n  git://thomasrast.ch/domjudge.git\n\n>   git ls-files | while read f; do git blame -M -- \"$f\"; done |\n[...]\n>   git log --no-merges -p upstream/2.2.. | grep '^+' | grep -v -c '^+++'\n[...]\n> Björn Steinbrink suggested on IRC that I use -M5 -C5 -C5 -C5, which\n> indeed reduces it to\n\nAs Björn kindly pointed out once he had access to the repo, the blame\n-M works for binary files too, while log -p doesn't; and\n'bin/sh-static' and 'doc/logos/DOMjudgelogo.pdf' live under other\nnames in the upstream repository too, so sufficiently many -C blame\nthem on upstream instead.  So that resolves the mystery.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}