{"thread":{"id":"44907","subject":"difflame","startedAt":"2017-01-18T05:25:46Z","lastAt":"2017-02-03T04:48:03Z","messageCount":8,"participants":["Edmundo Carmona Antoranz","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"309611","messageId":"CAOc6etaCk=OEyarMNhorM94MBnYRscCkJBM-K08snv1ecmOaPQ@mail.gmail.com","threadId":"44907","inReplyTo":null,"subject":"difflame","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2017-01-18T05:24:02Z","receivedAt":"2017-01-18T05:25:46Z","isPatch":false,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"Hi!\n\nFor a very long time I had wanted to get the output of diff to include\nblame information as well (to see when something was added/removed).\n\nI just created a very small (and rough) tool for that purpose. It's\nwritten in python and if it gets to something better than a small\ntool, I think it could be worth to be added into git main (perhaps\ninto contrib?).\n\nIf you want to give ir a try:\nhttps://github.com/eantoranz/difflame\n\nJust provide the two treeishs you would like to diff (no more\nparameters are accepted at the time) and you will get the diff along\nwith blame. Running it right now on the project itself:\n\n✔ ~/difflame [master L|⚑ 1]\n23:21 $ ./difflame.py HEAD~3 HEAD~\ndiff --git a/README.txt b/README.txt\nnew file mode 100644\nindex 0000000..a82aa27\n--- /dev/null\n+++ b/README.txt\n@@ -0,0 +1,11 @@\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  1) difflame\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  2)\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  3)\nCopyright 2017 Edmundo Carmona Antoranz\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  4)\nReleased under the terms of GPLv2\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  5)\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  6) Show\nthe output of diff with the additional information of blame.\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  7)\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  8)\nLines that remain the same or that were added will indicate when those\nlines were 'added' to the file\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600  9)\nLines that were removed will display the last revision where those\nlines were _present_ on the file (as provided by blame --re\nverse)\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600 10)\n+3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600 11) At\nthe moment, only two parameters need to be provided: two treeishs to\nget the diff from\ndiff --git a/difflame.py b/difflame.py\nindex f6e879b..06bfc03 100755\n--- a/difflame.py\n+++ b/difflame.py\n@@ -112,16 +112,20 @@ def process_file_from_diff_output(output_lines,\nstarting_line):\nc661286f (Edmundo Carmona Antoranz 2017-01-17 20:10:07 -0600 112)\ndiff_line = output_lines[i].split()\nc661286f (Edmundo Carmona Antoranz 2017-01-17 20:10:07 -0600 113)\nif diff_line[0] != \"diff\":\nc661286f (Edmundo Carmona Antoranz 2017-01-17 20:10:07 -0600 114)\n   raise Exception(\"Doesn't seem to exist a 'diff' line at line \" +\nstr(i + 1) + \": \" + output_lines[i])\n-3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600 115)\noriginal_name = diff_line[1]\n-3d426842 (Edmundo Carmona Antoranz 2017-01-17 22:26:18 -0600 116)\nfinal_name = diff_line[2]\n+f135bf04 (Edmundo Carmona Antoranz 2017-01-17 22:50:50 -0600 115)\noriginal_name = diff_line[2]\n+f135bf04 (Edmundo Carmona Antoranz 2017-01-17 22:50:50 -0600 116)\nfinal_name = diff_line[3]\nc661286f (Edmundo Carmona Antoranz 2017-01-17 20:10:07 -0600 117)\nprint output_lines[i]; i+=1\n.\n.\n.\n\n\nHope you find it useful\n\nBest regards!\n"},{"id":"310485","messageId":"20170128035321.yrcqwkg2fiwadxj4@sigill.intra.peff.net","threadId":"44907","inReplyTo":"CAOc6etaCk=OEyarMNhorM94MBnYRscCkJBM-K08snv1ecmOaPQ@mail.gmail.com","subject":"Re: difflame","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-28T03:53:21Z","receivedAt":"2017-01-28T03:54:09Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:\n\n> For a very long time I had wanted to get the output of diff to include\n> blame information as well (to see when something was added/removed).\n\nThis is something I've wanted, too. The trickiest part, though, is\nblaming deletions, because git-blame only tracks the origin of content,\nnot the origin of a change.\n\nFor example, try this case:\n\n  git init\n  for i in $(seq 1 10); do\n    echo $i >>file\n    git add file\n    git commit -m \"add $i\"\n  done\n  sed 4d <file >tmp && mv tmp file\n  git commit -am \"drop 4\"\n\nRunning \"difflame HEAD~5 HEAD\" produces this output:\n\n  diff --git a/file b/file\n  index b414108..051c298 100644\n  --- a/file\n  +++ b/file\n  @@ -1,6 +1,9 @@\n   ^2b028ff (Jeff King 2017-01-27 22:44:10 -0500 1) 1\n   ed056366 (Jeff King 2017-01-27 22:44:10 -0500 2) 2\n   771030d8 (Jeff King 2017-01-27 22:44:10 -0500 3) 3\n  -89c09c82 (Jeff King 2017-01-27 22:44:10 -0500 4) 4\n   b619039c (Jeff King 2017-01-27 22:44:10 -0500 4) 5\n   6a7aa0e5 (Jeff King 2017-01-27 22:44:10 -0500 5) 6\n  +39bc9dc4 (Jeff King 2017-01-27 22:44:10 -0500 6) 7\n  +f253cc8f (Jeff King 2017-01-27 22:44:10 -0500 7) 8\n  +85c10f46 (Jeff King 2017-01-27 22:44:10 -0500 8) 9\n  +89c09c82 (Jeff King 2017-01-27 22:44:10 -0500 9) 10\n\nThe last 4 lines are right; they correspond to the addition commits. But\nthe line taking away 4 is wrong. You can see even without looking at its\npatch, because it is blamed to the same commit that added \"10\", which\nis wrong.\n\nSorry I don't have a solution. I think it's an open problem with\ngit-blame, though you could probably script something around \"git blame\n--reverse\". See the commit message of 85af7929e (git-blame --reverse,\n2008-04-02) for some discussion.\n\n-Peff\n"},{"id":"310555","messageId":"xmqqd1f4uug6.fsf@gitster.mtv.corp.google.com","threadId":"44907","inReplyTo":"20170128035321.yrcqwkg2fiwadxj4@sigill.intra.peff.net","subject":"Re: difflame","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-30T21:08:41Z","receivedAt":"2017-01-30T21:08:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:\n>\n>> For a very long time I had wanted to get the output of diff to include\n>> blame information as well (to see when something was added/removed).\n>\n> This is something I've wanted, too. The trickiest part, though, is\n> blaming deletions, because git-blame only tracks the origin of content,\n> not the origin of a change.\n\nHmph, this is a comment without looking at what difflame does\ninternally, so you can ignore me if I am misunderstood what problem\nyou are pointing out, but I am not sure how \"tracks the origin of\ncontent\" could be a problem.\n\nIf output from \"git show\" says this:\n\n\t--- a/file\n\t+++ b/file\n\t@@ -1,5 +1,6 @@\n\t a\n\t b\n\t-c\n\t+C\n\t+D\n\t d\n\t e\n\nin order to annotate lines 'a', 'b', 'd', and 'e' for their origin,\nyou would run 'blame' on the commit the above output was taken from\n(or its parent---they are in the context so either would be OK).\n\nYou know where 'C' and 'D' came from already.  It's the commit you\nare feeding \"git show\".\n\nIn order to run blame to find where 'c' came from, you need to start\nat the _parent_ of the commit the above output came from, and the\nhunk header shows which line range to find the final 'c'.\n\nSo...\n\n"},{"id":"310576","messageId":"20170130232559.krdxkt4dq4lfv4rj@sigill.intra.peff.net","threadId":"44907","inReplyTo":"xmqqd1f4uug6.fsf@gitster.mtv.corp.google.com","subject":"Re: difflame","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-30T23:26:00Z","receivedAt":"2017-01-30T23:26:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jan 30, 2017 at 01:08:41PM -0800, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:\n> >\n> >> For a very long time I had wanted to get the output of diff to include\n> >> blame information as well (to see when something was added/removed).\n> >\n> > This is something I've wanted, too. The trickiest part, though, is\n> > blaming deletions, because git-blame only tracks the origin of content,\n> > not the origin of a change.\n> \n> Hmph, this is a comment without looking at what difflame does\n> internally, so you can ignore me if I am misunderstood what problem\n> you are pointing out, but I am not sure how \"tracks the origin of\n> content\" could be a problem.\n> \n> If output from \"git show\" says this:\n> \n> \t--- a/file\n> \t+++ b/file\n> \t@@ -1,5 +1,6 @@\n> \t a\n> \t b\n> \t-c\n> \t+C\n> \t+D\n> \t d\n> \t e\n> \n> in order to annotate lines 'a', 'b', 'd', and 'e' for their origin,\n> you would run 'blame' on the commit the above output was taken from\n> (or its parent---they are in the context so either would be OK).\n> \n> You know where 'C' and 'D' came from already.  It's the commit you\n> are feeding \"git show\".\n\nI think the point (or at least as I understand it) is that the diff is\nnot \"git show\" for a particular commit. It could be part of a much\nlarger diff that covers many commits.\n\nAs a non-hypothetical instance, I have a fork of git.git that has\nvarious enhancements. I want to feed those enhancements upstream. I need\nto know which commits should be cherry-picked to get those various\nenhancements.\n\nLooking at \"log origin..fork\" tells me too many commits, because it\nincludes ones which aren't useful anymore. Either because they already\nwent upstream, or because they were cherry-picked to the fork and their\nupstream counterparts merged (or even equivalent commits made upstream\nthat obsoleted the features).\n\nLooking at \"git diff origin fork\" tells me what the actual differences\nare, but it doesn't show me which commits are responsible for them.\n\nI can \"git blame\" each individual line of the diff (starting with \"fork\"\nas the tip), but that doesn't work for lines that no longer exist (i.e.,\nwhen the interesting change is a deletion).\n\n> In order to run blame to find where 'c' came from, you need to start\n> at the _parent_ of the commit the above output came from, and the\n> hunk header shows which line range to find the final 'c'.\n\nSo perhaps that explains my comment more. \"blame\" is not good for\nfinding which commit took away a line. I've tried using \"blame\n--reverse\", but it shows you the parent of the commit you are looking\nfor, which is slightly annoying. :)\n\n\"git log -S\" is probably a better tool for finding that.\n\n-Peff\n"},{"id":"310584","messageId":"CAOc6etZZSgeBRwQA4C4Ag5A48W8tAAArdOaaKxkTOVvVGi+EpQ@mail.gmail.com","threadId":"44907","inReplyTo":"20170130232559.krdxkt4dq4lfv4rj@sigill.intra.peff.net","subject":"Re: difflame","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2017-01-31T01:35:23Z","receivedAt":"2017-01-31T01:43:17Z","isPatch":false,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"I'm thinking of something like this:\n\nSay I just discovered a problem in a file.... I want to see who worked\non it since some revision that I know is working fine (or even\nsomething as generic as HEAD~100..). It could be a number of people\nwith different revisions. I would diff to see what changed.... and\nblame the added lines (blame reverse to try to get as close as\npossible with a single command in case I want to see what happened\nwith something that was deleted). If I could get blame information of\nadded/deleted lines in a single run, that would help a lot.\n\nLo and behold: difflame.\n\n\n\nOn Mon, Jan 30, 2017 at 5:26 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Jan 30, 2017 at 01:08:41PM -0800, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>>\n>> > On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:\n>> >\n>> >> For a very long time I had wanted to get the output of diff to include\n>> >> blame information as well (to see when something was added/removed).\n>> >\n>> > This is something I've wanted, too. The trickiest part, though, is\n>> > blaming deletions, because git-blame only tracks the origin of content,\n>> > not the origin of a change.\n>>\n>> Hmph, this is a comment without looking at what difflame does\n>> internally, so you can ignore me if I am misunderstood what problem\n>> you are pointing out, but I am not sure how \"tracks the origin of\n>> content\" could be a problem.\n>>\n>> If output from \"git show\" says this:\n>>\n>>       --- a/file\n>>       +++ b/file\n>>       @@ -1,5 +1,6 @@\n>>        a\n>>        b\n>>       -c\n>>       +C\n>>       +D\n>>        d\n>>        e\n>>\n>> in order to annotate lines 'a', 'b', 'd', and 'e' for their origin,\n>> you would run 'blame' on the commit the above output was taken from\n>> (or its parent---they are in the context so either would be OK).\n>>\n>> You know where 'C' and 'D' came from already.  It's the commit you\n>> are feeding \"git show\".\n>\n> I think the point (or at least as I understand it) is that the diff is\n> not \"git show\" for a particular commit. It could be part of a much\n> larger diff that covers many commits.\n>\n> As a non-hypothetical instance, I have a fork of git.git that has\n> various enhancements. I want to feed those enhancements upstream. I need\n> to know which commits should be cherry-picked to get those various\n> enhancements.\n>\n> Looking at \"log origin..fork\" tells me too many commits, because it\n> includes ones which aren't useful anymore. Either because they already\n> went upstream, or because they were cherry-picked to the fork and their\n> upstream counterparts merged (or even equivalent commits made upstream\n> that obsoleted the features).\n>\n> Looking at \"git diff origin fork\" tells me what the actual differences\n> are, but it doesn't show me which commits are responsible for them.\n>\n> I can \"git blame\" each individual line of the diff (starting with \"fork\"\n> as the tip), but that doesn't work for lines that no longer exist (i.e.,\n> when the interesting change is a deletion).\n>\n>> In order to run blame to find where 'c' came from, you need to start\n>> at the _parent_ of the commit the above output came from, and the\n>> hunk header shows which line range to find the final 'c'.\n>\n> So perhaps that explains my comment more. \"blame\" is not good for\n> finding which commit took away a line. I've tried using \"blame\n> --reverse\", but it shows you the parent of the commit you are looking\n> for, which is slightly annoying. :)\n>\n> \"git log -S\" is probably a better tool for finding that.\n>\n> -Peff\n"},{"id":"310587","messageId":"CAOc6etYzAeD32oSjrvmv-PBJTdAGobsQ30iH8Q+Z9ShWOqiHfQ@mail.gmail.com","threadId":"44907","inReplyTo":"CAOc6etZZSgeBRwQA4C4Ag5A48W8tAAArdOaaKxkTOVvVGi+EpQ@mail.gmail.com","subject":"Re: difflame","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2017-01-31T02:37:10Z","receivedAt":"2017-01-31T02:37:15Z","isPatch":false,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"Maybe a little work on blame to get the actual revision where some\nlines were \"deleted\"?\n\nSomething like git blame --blame-deletion that could be based on --reverse?\n\nOn Mon, Jan 30, 2017 at 7:35 PM, Edmundo Carmona Antoranz\n<eantoranz@gmail.com> wrote:\n> I'm thinking of something like this:\n>\n> Say I just discovered a problem in a file.... I want to see who worked\n> on it since some revision that I know is working fine (or even\n> something as generic as HEAD~100..). It could be a number of people\n> with different revisions. I would diff to see what changed.... and\n> blame the added lines (blame reverse to try to get as close as\n> possible with a single command in case I want to see what happened\n> with something that was deleted). If I could get blame information of\n> added/deleted lines in a single run, that would help a lot.\n>\n> Lo and behold: difflame.\n>\n>\n>\n> On Mon, Jan 30, 2017 at 5:26 PM, Jeff King <peff@peff.net> wrote:\n>> On Mon, Jan 30, 2017 at 01:08:41PM -0800, Junio C Hamano wrote:\n>>\n>>> Jeff King <peff@peff.net> writes:\n>>>\n>>> > On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:\n>>> >\n>>> >> For a very long time I had wanted to get the output of diff to include\n>>> >> blame information as well (to see when something was added/removed).\n>>> >\n>>> > This is something I've wanted, too. The trickiest part, though, is\n>>> > blaming deletions, because git-blame only tracks the origin of content,\n>>> > not the origin of a change.\n>>>\n>>> Hmph, this is a comment without looking at what difflame does\n>>> internally, so you can ignore me if I am misunderstood what problem\n>>> you are pointing out, but I am not sure how \"tracks the origin of\n>>> content\" could be a problem.\n>>>\n>>> If output from \"git show\" says this:\n>>>\n>>>       --- a/file\n>>>       +++ b/file\n>>>       @@ -1,5 +1,6 @@\n>>>        a\n>>>        b\n>>>       -c\n>>>       +C\n>>>       +D\n>>>        d\n>>>        e\n>>>\n>>> in order to annotate lines 'a', 'b', 'd', and 'e' for their origin,\n>>> you would run 'blame' on the commit the above output was taken from\n>>> (or its parent---they are in the context so either would be OK).\n>>>\n>>> You know where 'C' and 'D' came from already.  It's the commit you\n>>> are feeding \"git show\".\n>>\n>> I think the point (or at least as I understand it) is that the diff is\n>> not \"git show\" for a particular commit. It could be part of a much\n>> larger diff that covers many commits.\n>>\n>> As a non-hypothetical instance, I have a fork of git.git that has\n>> various enhancements. I want to feed those enhancements upstream. I need\n>> to know which commits should be cherry-picked to get those various\n>> enhancements.\n>>\n>> Looking at \"log origin..fork\" tells me too many commits, because it\n>> includes ones which aren't useful anymore. Either because they already\n>> went upstream, or because they were cherry-picked to the fork and their\n>> upstream counterparts merged (or even equivalent commits made upstream\n>> that obsoleted the features).\n>>\n>> Looking at \"git diff origin fork\" tells me what the actual differences\n>> are, but it doesn't show me which commits are responsible for them.\n>>\n>> I can \"git blame\" each individual line of the diff (starting with \"fork\"\n>> as the tip), but that doesn't work for lines that no longer exist (i.e.,\n>> when the interesting change is a deletion).\n>>\n>>> In order to run blame to find where 'c' came from, you need to start\n>>> at the _parent_ of the commit the above output came from, and the\n>>> hunk header shows which line range to find the final 'c'.\n>>\n>> So perhaps that explains my comment more. \"blame\" is not good for\n>> finding which commit took away a line. I've tried using \"blame\n>> --reverse\", but it shows you the parent of the commit you are looking\n>> for, which is slightly annoying. :)\n>>\n>> \"git log -S\" is probably a better tool for finding that.\n>>\n>> -Peff\n"},{"id":"310787","messageId":"CAOc6etabV=h6fEVee=N2-3ERUU7_w6eCM006mSMPqiwkRycQBw@mail.gmail.com","threadId":"44907","inReplyTo":"CAOc6etYzAeD32oSjrvmv-PBJTdAGobsQ30iH8Q+Z9ShWOqiHfQ@mail.gmail.com","subject":"Re: difflame","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2017-02-03T04:46:44Z","receivedAt":"2017-02-03T04:46:56Z","isPatch":false,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"I have been \"scripting around git blame --reverse\" for some days now.\nMind taking a look? I've been working on blame-deletions for this.\n\n22:41 $ ../difflame/difflame.py HEAD~5 HEAD\ndiff --git a/file b/file\nindex b414108..051c298 100644\n--- a/file\n+++ b/file\n@@ -1,6 +1,9 @@\n^1513353 (Edmundo 2017-02-02 22:41:45 -0600 1) 1\nf20952eb (Edmundo 2017-02-02 22:41:45 -0600 2) 2\nbb04dc7c (Edmundo 2017-02-02 22:41:45 -0600 3) 3\n-de3c07b (Edmundo 2017-02-02 22:41:47 -060 4) 4\n058ea125 (Edmundo 2017-02-02 22:41:45 -0600 4) 5\n85fc6b81 (Edmundo 2017-02-02 22:41:45 -0600 5) 6\n+2cd990a6 (Edmundo 2017-02-02 22:41:45 -0600 6) 7\n+ab0be970 (Edmundo 2017-02-02 22:41:45 -0600 7) 8\n+944452c0 (Edmundo 2017-02-02 22:41:45 -0600 8) 9\n+6641edb0 (Edmundo 2017-02-02 22:41:45 -0600 9) 10\n\n\n$ git show de3c07b\ncommit de3c07bc21a83472d5c5ddf172dcb742665924dd (HEAD -> master)\nAuthor: Edmundo <eantoranz@gmail.com>\nDate:   Thu Feb 2 22:41:47 2017 -0600\n\n   drop 4\n\ndiff --git a/file b/file\nindex f00c965..051c298 100644\n--- a/file\n+++ b/file\n@@ -1,7 +1,6 @@\n1\n2\n3\n-4\n5\n6\n7\n\n\nNext step: solve the\nfind-real-deletion-revision-when-there-are-multiple-child-nodes\nproblem.... and let me read the discussion around git blame --reverse.\n\nThanks in advance.\n\nOn Mon, Jan 30, 2017 at 8:37 PM, Edmundo Carmona Antoranz\n<eantoranz@gmail.com> wrote:\n> Maybe a little work on blame to get the actual revision where some\n> lines were \"deleted\"?\n>\n> Something like git blame --blame-deletion that could be based on --reverse?\n>\n> On Mon, Jan 30, 2017 at 7:35 PM, Edmundo Carmona Antoranz\n> <eantoranz@gmail.com> wrote:\n>> I'm thinking of something like this:\n>>\n>> Say I just discovered a problem in a file.... I want to see who worked\n>> on it since some revision that I know is working fine (or even\n>> something as generic as HEAD~100..). It could be a number of people\n>> with different revisions. I would diff to see what changed.... and\n>> blame the added lines (blame reverse to try to get as close as\n>> possible with a single command in case I want to see what happened\n>> with something that was deleted). If I could get blame information of\n>> added/deleted lines in a single run, that would help a lot.\n>>\n>> Lo and behold: difflame.\n>>\n>>\n>>\n>> On Mon, Jan 30, 2017 at 5:26 PM, Jeff King <peff@peff.net> wrote:\n>>> On Mon, Jan 30, 2017 at 01:08:41PM -0800, Junio C Hamano wrote:\n>>>\n>>>> Jeff King <peff@peff.net> writes:\n>>>>\n>>>> > On Tue, Jan 17, 2017 at 11:24:02PM -0600, Edmundo Carmona Antoranz wrote:\n>>>> >\n>>>> >> For a very long time I had wanted to get the output of diff to include\n>>>> >> blame information as well (to see when something was added/removed).\n>>>> >\n>>>> > This is something I've wanted, too. The trickiest part, though, is\n>>>> > blaming deletions, because git-blame only tracks the origin of content,\n>>>> > not the origin of a change.\n>>>>\n>>>> Hmph, this is a comment without looking at what difflame does\n>>>> internally, so you can ignore me if I am misunderstood what problem\n>>>> you are pointing out, but I am not sure how \"tracks the origin of\n>>>> content\" could be a problem.\n>>>>\n>>>> If output from \"git show\" says this:\n>>>>\n>>>>       --- a/file\n>>>>       +++ b/file\n>>>>       @@ -1,5 +1,6 @@\n>>>>        a\n>>>>        b\n>>>>       -c\n>>>>       +C\n>>>>       +D\n>>>>        d\n>>>>        e\n>>>>\n>>>> in order to annotate lines 'a', 'b', 'd', and 'e' for their origin,\n>>>> you would run 'blame' on the commit the above output was taken from\n>>>> (or its parent---they are in the context so either would be OK).\n>>>>\n>>>> You know where 'C' and 'D' came from already.  It's the commit you\n>>>> are feeding \"git show\".\n>>>\n>>> I think the point (or at least as I understand it) is that the diff is\n>>> not \"git show\" for a particular commit. It could be part of a much\n>>> larger diff that covers many commits.\n>>>\n>>> As a non-hypothetical instance, I have a fork of git.git that has\n>>> various enhancements. I want to feed those enhancements upstream. I need\n>>> to know which commits should be cherry-picked to get those various\n>>> enhancements.\n>>>\n>>> Looking at \"log origin..fork\" tells me too many commits, because it\n>>> includes ones which aren't useful anymore. Either because they already\n>>> went upstream, or because they were cherry-picked to the fork and their\n>>> upstream counterparts merged (or even equivalent commits made upstream\n>>> that obsoleted the features).\n>>>\n>>> Looking at \"git diff origin fork\" tells me what the actual differences\n>>> are, but it doesn't show me which commits are responsible for them.\n>>>\n>>> I can \"git blame\" each individual line of the diff (starting with \"fork\"\n>>> as the tip), but that doesn't work for lines that no longer exist (i.e.,\n>>> when the interesting change is a deletion).\n>>>\n>>>> In order to run blame to find where 'c' came from, you need to start\n>>>> at the _parent_ of the commit the above output came from, and the\n>>>> hunk header shows which line range to find the final 'c'.\n>>>\n>>> So perhaps that explains my comment more. \"blame\" is not good for\n>>> finding which commit took away a line. I've tried using \"blame\n>>> --reverse\", but it shows you the parent of the commit you are looking\n>>> for, which is slightly annoying. :)\n>>>\n>>> \"git log -S\" is probably a better tool for finding that.\n>>>\n>>> -Peff\n"},{"id":"310788","messageId":"CAOc6etZhQUdM9+6xty=G04t9dSXXP1BL3Ffa-a68XFbgCVOgtw@mail.gmail.com","threadId":"44907","inReplyTo":"CAOc6etabV=h6fEVee=N2-3ERUU7_w6eCM006mSMPqiwkRycQBw@mail.gmail.com","subject":"Re: difflame","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2017-02-03T04:47:58Z","receivedAt":"2017-02-03T04:48:03Z","isPatch":false,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"On Thu, Feb 2, 2017 at 10:46 PM, Edmundo Carmona Antoranz\n<eantoranz@gmail.com> wrote:\n> I have been \"scripting around git blame --reverse\" for some days now.\n> Mind taking a look? I've been working on blame-deletions for this.\n\nblame-deletions branch, that is\n\nSorry for the previous top-posting.\n"}]}