From: Junio C Hamano <gitster@pobox.com>
To: Eric Amodio <eamodio@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: BUG: Git blame provides incorrect previous commit if the line is uncommitted
Date: Mon, 26 Sep 2016 09:05:36 -0700 [thread overview]
Message-ID: <xmqqk2dyve7j.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAJxnqO6oMG2RvwP7y0Yt_xTrfeqqO6ZOUn5HWF7-h1hcjY+=bg@mail.gmail.com> (Eric Amodio's message of "Mon, 26 Sep 2016 08:29:44 -0400")
Eric Amodio <eamodio@gmail.com> writes:
> This is the first time I've reported a bug with Git so please forgive
> me if this isn't the right place, format, etc.
>
> If git blame --porcelain (or --line-porcelain or --incremental) is run
> on a file that has uncommitted changes any uncommitted lines have the
> wrong previous sha. Instead of the sha the last time that line was
> changed or even the last time the file was changed it seem to return
> the last commit in the repository.
This is not limited to the case where uncommitted changes getting
blamed to the working tree, I think. Replace C in the following
description with "a fictional commit C that would have made as a
direct child of HEAD if you were to commit all these uncommited
changes" and read on.
When the command finds that a line is attributed to commit C,
"previous" field in the internal data structure the command uses to
keeps track of the ancestry is shown there. What the field means is
this:
The command compared C (the final answer) with this "previous"
commit (typically a parent of it, but when you use -S or
--reverse option it may be different), and it was found that C
introduced this line.
So, no. "previous" is not "what would the result of running another
'git blame' on the state _before_ C to blame the general area?" It
is meant as a hint for _you_ (rather, whatever tool is reading the
incremental output) telling where to run another blame if you want
to dig further, and it does not waste cycles to compute another
blame on each and every output to show that before being asked.
prev parent reply other threads:[~2016-09-26 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 12:29 BUG: Git blame provides incorrect previous commit if the line is uncommitted Eric Amodio
2016-09-26 16:05 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk2dyve7j.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=eamodio@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox