On Wed, 2013-03-27 at 11:35 -0400, Paul Smith wrote:
> On Wed, 2013-03-27 at 11:30 -0400, Dale R. Worley wrote:
> > I do not see why merging a branch in will cause all lines in the file
> > to be marked as changed by the user who did the merge (from whose
> > branch the merge was done).  Assuming the reformatting in the master
> > and the reformatting in the developer's branch is exactly the same,
> > when the developer goes to merge his changes back into master, only
> > lines that he changed "for real" will be different -- lines that were
> > changed only by reformatting will be changed in exactly the same way
> > in both sources, and presumably "git blame" does not consider them to
> > be changed by the merge.
> Ah.  Interesting.  Maybe my problem is I stopped part-way through and
> extrapolated incorrectly.  Looking at the _branch_ I see everything is
> modified by the developer.
> But you're saying if I merge back to master then the changes already on
> master will be preferred and all those lines will be blamed on the
> reformat user, just as I hoped.  That sounds reasonable.

Unfortunately this doesn't appear to be the case.  To merge the branch
back to master I've tried both a simple merge (which fast-forwards
master to the branch commit) and also using --no-ff on the merge, and
using -s recursive -X ours on the merge, but in all cases while "git
diff" of the merge commit with its ancestor shows only the branch
changes without any reformat changes (what I want), "git blame" shows
the reformatted content as blamed on the developer, not on the
reformatter account.

I'm not sure exactly how "git blame" works: the naive implementation
would walk back commits until it found one where each line was changed
(using a string compare).  If that were the algorithm, the above would
work as I want.  Obviously "git blame" is doing something more
sophisticated.  Somehow it knows that commit A changed line 10, even
though line 10 is identical between commit A and its parent commit
(according to "git diff").

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to