git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 23, 2009, 23:50 UTC
Message-ID
<7v1vsn6boc.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1237803348-9329-1-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 12 quoted lines
> 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.

Show 5 quoted lines
> 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?

Previous: David AguilarNext: Jakub Narebski
Message 7 of 12 in “difftool: add support for an extended revision syntax”
  1. difftool: add support for an extended revision syntaxDavid Aguilar, Mar 23, 2009
  2. Michael J GruberMar 23, 2009
  3. David AguilarMar 23, 2009
  4. Michael J GruberMar 23, 2009
  5. Junio C HamanoMar 23, 2009
  6. David AguilarMar 23, 2009
  7. Junio C HamanoMar 23, 2009
  8. Jakub NarebskiMar 27, 2009
  9. David AguilarMar 27, 2009
  10. Junio C HamanoMar 27, 2009
  11. David AguilarMar 27, 2009
  12. Junio C HamanoMar 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.