git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC GSoc Idea: blame: do not overly favor earlier parents
@ 2014-03-06 20:02 Junio C Hamano
  2014-03-06 20:21 ` David Kastrup
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2014-03-06 20:02 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-06 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 20:02 RFC GSoc Idea: blame: do not overly favor earlier parents Junio C Hamano
2014-03-06 20:21 ` David Kastrup
2014-03-06 20:24   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).