Re: [PATCH] diff-tree -c: show a merge commit a bit more sensibly.

From: Junio C Hamano <junkio@cox.net>
Date: 2006-01-25 13:08:59
Linus Torvalds <torvalds@osdl.org> writes:

> On Tue, 24 Jan 2006, Junio C Hamano wrote:
>>
>> A new option '-c' to diff-tree changes the way a merge commit is
>> displayed when generating a patch output.  It shows a "combined
>> diff" (hence the option letter 'c'), which looks like this:
>
> Can you make this the default for "git-whatchanged" too? That way, merges 
> that have manual fixups will actually show up in the whatchanged output.

One problem with that I see is that it would mean making the
patch output as the default for whatchanged, since I made '-c'
to imply '-p' (I did not think of a reasonable 'combined diff'
behaviour for the diff-raw output).

I suspect many people are now used to the current default of
showing an abbreviated diff-raw and use it to quickly sanity
check the list of paths touched by each commit, so I am not so
sure that '-c' would be a good default for whatchanged.

For now, please do "git-repo-config whatchanged.difftree" ;-).

BTW, one feature that might be interesting is to tell either
rev-list or diff-tree to show _only_ merges.  My debugging
session went like this:

	$ git rev-list --all --parents |
          sed -ne 's/\([^ ]*\) [^ ]* [^ ].*/\1/p' |
          git diff-tree -c --stdin --pretty

I doubt such a flag would be of any practical value other than
curiosity, though.

> Also, it would be perhaps even nicer if it had a "dense" version, which 
> only showed the chunks that had differences from more than one parent. 
> Chunks that have diffs from just one parent obviously had no conflicts in 
> that chunk, so they are much less interesting than a chunk that was 
> different from more than one parent..

I agree that would be useful.  The logic to cull "uninteresting"
commit comes much earlier than the combined diff is split into
hunks, so it is probably not trivial (but I suspect not hard) to
arrange.  For now, I output the "diff --combined" header along
with the commit log even if "dense" ends up removing all hunks
as not-so-interesting.  An updated version is currently in the
"pu" branch.

I think the current output can be enhanced to have "-line,count"
for all parents to make the output machine applicable (i.e. we
could teach git-apply to take such a patch, which is somewhat
yucky) but I suspect dense mode would make that inpractical.  I
personally think combined diff is purely for human consumption,
so the machine applicability may not be an issue.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Jan 25 13:09:37 2006

This archive was generated by hypermail 2.1.8 : 2006-01-25 13:09:46 EST