{"thread":{"id":"37510","subject":"Check out git-author","startedAt":"2014-09-07T23:05:13Z","lastAt":"2014-09-08T07:16:20Z","messageCount":3,"participants":["xmeng","Jeff King","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"249020","messageId":"0a3b0f232ec56517d4db43c6bd6ebb63@cs.wisc.edu","threadId":"37510","inReplyTo":null,"subject":"Check out git-author","fromName":"xmeng","fromEmail":"xmeng@cs.wisc.edu","sentAt":"2014-09-07T23:05:13Z","receivedAt":"2014-09-07T23:05:13Z","isPatch":false,"sender":{"key":"xmeng@cs.wisc.edu","avatar":null},"body":"Hi all,\n\nI have been using git-blame to track who changed a line of code or who \nto blame for a line of code. It is easy to use. For example, for this \nparticular line of code:\n\n$ git blame -L 2235,2235 fs/ext4/mballoc.c\n85556c9a (Wei Yongjun 2012-09-26 20:43:37 -0400 2235)   \nmeta_group_info[i] = kmem_cache_zalloc(cachep, GFP_KERNEL);\n\nThe problem with git-blame is that it only reports the last \nauthor/commit that changed the line, regardless of the magnitude of the \nchange. Sometimes, the last author may only change a tiny part of the \ncode and should not be blamed. I developed a built-in tool called \n\"git-author\" to address this problem. Git-author is designed to track \nthe complete development history of a line. For the same line of code:\n\n$ git author -c -L 2235,2235 fs/ext4/mballoc.c\n        CURRENT LINE 2235:       meta_group_info[i] = \nkmem_cache_zalloc(cachep, GFP_KERNEL);\n85556c9 Wei Yongjun     :       meta_group_info[i] = \nkmem_cache_zalloc(cachep, GFP_KERNEL);\nfb1813f Curt Wohlgemuth :       meta_group_info[i] = \nkmem_cache_alloc(cachep, GFP_KERNEL);\n5f21b0e Frederic Bohe   :       meta_group_info[i] = kzalloc(len, \nGFP_KERNEL);\nc9de560 Alex Tomas      :               meta_group_info[j] = \nkzalloc(len, GFP_KERNEL);\n\nGit-author shows the complete development history of this line code. We \ncan see \"Wei Yongjun\" only changed the line to call a different function \n(from \"kmem_cache_alloc\" to \"kmem_cache_zalloc\"). \"Wei yongjun\" is not \nresponsible for the other part of the line. \"Curt Wohlgemuth\" changed \nthe line to call a different function (from \"kzalloc\" to \n\"kmem_cache_alloc\") and to use a different parameter (from \"len\" to \n\"cachep\") and \"Frederic Bohe\" changed the line to use a different array \nindex (from \"i\" to \"j\").\n\nGit-author should be useful to people who wants to see the complete \nhistory of lines of code.\n\nIf you are interested in git-author, you can check it out at \nhttps://github.com/mxz297/git/tree/git-author (please check out branch \n'git-author'). Also we have a paper describing more technical details \nabout git-author in ICSM 2013 \n(ftp://ftp.cs.wisc.edu/paradyn/papers/Meng13Authorship.pdf).\n\nLet me know if you have any question, feedback, bug about git-author!\n\n\nThanks\n\n--Xiaozhu\n"},{"id":"249022","messageId":"20140908051956.GA8987@peff.net","threadId":"37510","inReplyTo":"0a3b0f232ec56517d4db43c6bd6ebb63@cs.wisc.edu","subject":"Re: Check out git-author","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-09-08T05:19:56Z","receivedAt":"2014-09-08T05:19:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Sep 07, 2014 at 06:05:13PM -0500, xmeng wrote:\n\n> The problem with git-blame is that it only reports the last author/commit\n> that changed the line, regardless of the magnitude of the change. Sometimes,\n> the last author may only change a tiny part of the code and should not be\n> blamed. I developed a built-in tool called \"git-author\" to address this\n> problem. Git-author is designed to track the complete development history of\n> a line. For the same line of code:\n> \n> $ git author -c -L 2235,2235 fs/ext4/mballoc.c\n> [...]\n\nHave you tried \"git log -L 2235,2235:fs/ext4/mballoc.c --\nfs/ext4/mballoc.c\"? Can you compare your approach to that of \"log -L\"?\n\n-Peff\n"},{"id":"249023","messageId":"540D57C4.7000602@web.de","threadId":"37510","inReplyTo":"20140908051956.GA8987@peff.net","subject":"Re: Check out git-author","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-09-08T07:16:20Z","receivedAt":"2014-09-08T07:16:20Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 09/08/2014 07:19 AM, Jeff King wrote:\n> Have you tried \"git log -L 2235,2235:fs/ext4/mballoc.c --\n> fs/ext4/mballoc.c\"? Can you compare your approach to that of \"log -L\"?\n>\n> -Peff\n>\nNice, but it doesn't seem to work 100 % (?)\n\n\n\ntb@linux:~/projects/git/git.pu/t$ git log t3910-mac-os-precompose.sh | \ngrep \"^commit\"\ncommit 1265886303778b5a2631c41c6ee61094c5fda7b0\ncommit a4cf6b4b91835c1d8d13ebb5cf3ce9241e181f1b\ncommit 750b2e4785e5956122b3c565af65eb1929714fba\ncommit 92b0c8bed0d3f6ed5442e3ffa178413772faa31b\ncommit 308566eb8b35b9279082bd5398c4252169d52b22\ncommit 76759c7dff53e8c84e975b88cb8245587c14c7ba\n\nI'm quite sure that line 15 looks like this in the original commit 76759c7d:\n\n\">junk/\"$Adiarnfc\" &&\"\n\nBut it is not shown:\ntb@linux:~/projects/git/git.pu/t$ git log -L \n15,15:t3910-mac-os-precompose.sh -- t3910-mac-os-precompose.sh\ncommit 308566eb8b35b9279082bd5398c4252169d52b22\nAuthor: Michael J Gruber <git@drmicha.warpmail.net>\nDate:   Mon Jul 30 11:57:18 2012 +0200\n\n     t3910: use the UTF8_NFD_TO_NFC test prereq\n\n     Besides reusing the new test prerequisite, this fixes also the issue\n     that the current output is not TAP compliant and produces the \noutput \"no\n     reason given\" [for skipping].\n\n     Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n     Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\ndiff --git a/t/t3910-mac-os-precompose.sh b/t/t3910-mac-os-precompose.sh\n--- a/t/t3910-mac-os-precompose.sh\n+++ b/t/t3910-mac-os-precompose.sh\n@@ -10,0 +15,1 @@\n+\n============================\nBut line 20 seems to work better (I shortened the output by using grep):\n\ntb@linux:~/projects/git/git.pu/t$ git log -L \n20,20:t3910-mac-os-precompose.sh -- t3910-mac-os-precompose.sh | grep \n\"^commit\"\ncommit a4cf6b4b91835c1d8d13ebb5cf3ce9241e181f1b\ncommit 308566eb8b35b9279082bd5398c4252169d52b22\ncommit 76759c7dff53e8c84e975b88cb8245587c14c7ba\n"}]}