{"thread":{"id":"44159","subject":"BUG: Git blame provides incorrect previous commit if the line is uncommitted","startedAt":"2016-09-26T12:29:50Z","lastAt":"2016-09-26T16:05:45Z","messageCount":2,"participants":["Eric Amodio","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"302573","messageId":"CAJxnqO6oMG2RvwP7y0Yt_xTrfeqqO6ZOUn5HWF7-h1hcjY+=bg@mail.gmail.com","threadId":"44159","inReplyTo":null,"subject":"BUG: Git blame provides incorrect previous commit if the line is uncommitted","fromName":"Eric Amodio","fromEmail":"eamodio@gmail.com","sentAt":"2016-09-26T12:29:44Z","receivedAt":"2016-09-26T12:29:50Z","isPatch":false,"sender":{"key":"eamodio@gmail.com","avatar":null},"body":"This is the first time I've reported a bug with Git so please forgive\nme if this isn't the right place, format, etc.\n\nIf git blame --porcelain (or --line-porcelain or --incremental) is run\non a file that has uncommitted changes any uncommitted lines have the\nwrong previous sha. Instead of the sha the last time that line was\nchanged or even the last time the file was changed it seem to return\nthe last commit in the repository. This seems to only affect\nuncommitted lines, other line seem to be populated properly.\n\nI am using git version 2.10.0 on macOS 10.12 (16A323).\n\nPlease let me know if I can provide any more information.\n\nThanks,\nEric Amodio\n"},{"id":"302579","messageId":"xmqqk2dyve7j.fsf@gitster.mtv.corp.google.com","threadId":"44159","inReplyTo":"CAJxnqO6oMG2RvwP7y0Yt_xTrfeqqO6ZOUn5HWF7-h1hcjY+=bg@mail.gmail.com","subject":"Re: BUG: Git blame provides incorrect previous commit if the line is uncommitted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-26T16:05:36Z","receivedAt":"2016-09-26T16:05:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Amodio <eamodio@gmail.com> writes:\n\n> This is the first time I've reported a bug with Git so please forgive\n> me if this isn't the right place, format, etc.\n>\n> If git blame --porcelain (or --line-porcelain or --incremental) is run\n> on a file that has uncommitted changes any uncommitted lines have the\n> wrong previous sha. Instead of the sha the last time that line was\n> changed or even the last time the file was changed it seem to return\n> the last commit in the repository.\n\nThis is not limited to the case where uncommitted changes getting\nblamed to the working tree, I think.  Replace C in the following\ndescription with \"a fictional commit C that would have made as a\ndirect child of HEAD if you were to commit all these uncommited\nchanges\" and read on.\n\nWhen the command finds that a line is attributed to commit C,\n\"previous\" field in the internal data structure the command uses to\nkeeps track of the ancestry is shown there.  What the field means is\nthis:\n\n    The command compared C (the final answer) with this \"previous\"\n    commit (typically a parent of it, but when you use -S or\n    --reverse option it may be different), and it was found that C\n    introduced this line.\n\nSo, no.  \"previous\" is not \"what would the result of running another\n'git blame' on the state _before_ C to blame the general area?\"  It\nis meant as a hint for _you_ (rather, whatever tool is reading the\nincremental output) telling where to run another blame if you want\nto dig further, and it does not waste cycles to compute another\nblame on each and every output to show that before being asked.\n"}]}