Subject: Re: [PATCH] difftool: add support for an extended revision syntax

From: Junio C Hamano <[email-masked]>
Date: Mon, 23 Mar 2009 16:50:59 -0700

David Aguilar <[email-masked]> writes:

> This makes answering that question considerably easier.
> Users can now simply say:
>
> 	$ git difftool <file>~
>
> to compare <file> in the worktree against its
> previous version, and:
>
> 	$ git difftool <file>~2 <file>~
>
> to compare <file> from 2 versions ago to <file>'s
> previous version, etc.

These two examples are not that interesting.  Because you can say:

	$ git log -p -1 file
	$ git log -p -2 file

(admittedly you need to skip the first entry of the output in the latter
one to get to what you are interested in).

What existing syntax does not allow you to say easily is something like:

	$ git difftool <file>~4 <file>

That is, "I do not care about the intermediate states, but want to see the
4 changes consolidated in one".

As I told you in my previous message, I am not convinced a short-and-sweet
notation such as tilde-four is expressive enough for most user's needs (I
suspect most users use git as a fast CVS and have rather linear history,
in which case "Nth commit that changes the file, following only the first
parent chain down from the HEAD" _could_ be a perfectly fine and useful
semantics), but if it is, I think it would not be too involved to patch
revision.c::handle_revision_arg() to make it available to everybody.

> This makes the following statements equivalent:
>
> 	$ git difftool !
> 	$ git difftool HEAD!
> 	$ git difftool HEAD~ HEAD

Which would be:

	$ git log -p -1 file

right?

Perhaps we would want a convenient way for "log -p" or "show -p" to drive
difftool as a backend?