From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: RFC GSoc Idea: blame: do not overly favor earlier parents
Date: Thu, 06 Mar 2014 12:02:14 -0800 [thread overview]
Message-ID: <xmqq8usnxfi1.fsf@gitster.dls.corp.google.com> (raw)
When looking at a merge, "git blame" inspects the blob object names
of all parents and if one of them exactly match the merge result,
pass the entire blame down to that parent. This is very much in
line with the history simplification done with "git log" when
traversing a history with merges.
On the other hand, when the blob object in the merge result and none
of the parents match exactly, we let each parent to take as much blame
as they can, starting from the earlier parent, and later parents get
a chance to take blame on the "leftover bits".
Combination of the above can lead to an unexpected results.
Let's say that M is a two-parent merge, M^1 == A and M^2 == B, and
that M:path == B:path != A:path (i.e. the merge result matches its
second parent exactly). The entire contents of the path is blamed
to the history leading to B; the history leading to A but not
involved in B will not get any blame.
Now, imagine if you amend M to create N, to add a single line at the
end of path. M:path != N:path but there is very small difference
between the two. That means B:path != N:path but the difference
between this merged result and the second parent is very small.
Because we give the chance to get blamed for the whole thing to the
first parent, however, A will grab blame for all the lines that are
common between A:path and B:path. For the lines that are the same
between M:path and N:path, ideally, we should get identical results,
but it results in a very inconsistent behaviour.
Update blame.c::pass_blame() and give an option to arrange the list
of "scapegoats" in the order that are similar to the end result, in
order to address this issue. That way, when blaming N:path, we will
inspect B:path first and let it grab as much blame, as it would happen
when we started the blame for M:path.
next reply other threads:[~2014-03-06 20:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 20:02 Junio C Hamano [this message]
2014-03-06 20:21 ` RFC GSoc Idea: blame: do not overly favor earlier parents David Kastrup
2014-03-06 20:24 ` Junio C Hamano
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=xmqq8usnxfi1.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.