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

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

From
David Aguilar <davvid@gmail.com>
Date
Mar 27, 2009, 16:28 UTC
Message-ID
<20090327162849.GA2853@gmail.com>
In-Reply-To
<m33acz2byv.fsf@localhost.localdomain>
On  0, Jakub Narebski <jnareb@gmail.com> wrote:
Show 21 quoted lines
> David Aguilar <davvid@gmail.com> writes:
> 
> > This adds an extended revision syntax to git-difftool.
> > Users often ask "how do I compare a file against its
> > previous version" and the answer is typically a combination
> > of 'git log <file>' and 'git difftool <sha1> <sha1> <file>'.
> > 
> > [snip]
> > 
> > The extended revision syntax also expands revisions
> > that are suffixed with '!' as a convenient way to
> > see commit diffs.  Specifying only '!' is equivalent
> > to specifying 'HEAD!'.
> > 
> > This makes the following statements equivalent:
> > 
> > 	$ git difftool !
> > 	$ git difftool HEAD!
> > 	$ git difftool HEAD~ HEAD
> 
> Errr... there already exists such syntax, and it is called HEAD^!
Yup, this patch was a mistake ;)

^! does exactly what I needed and difftool supports it since git-diff does.

I'm still interested in the file~<n> idea [though maybe not that exact syntax] and have been reading revision.c (as Junio suggested) to see if it can be done in a good way.

I'm still not sure if it is a good idea since the types of users who would want it are probably better off with tighter integration between gitk and difftool as opposed to a convenient command-line syntax (tho I do see how it would be useful every now and then). Ideally, we'd want to select two commits in gitk and compare them. I think qgit can do that, but it doesn't yet know about difftool (since, of course, difftool is not in master yet).

I noticed that my patches for "add tests to difftool" and "add the -y shortcut for --no-prompt" were in git.git's pu branch the other day but aren't there anymore. Was that intentional?

Show 14 quoted lines
> (if git-difftool can accept a..b revision specification)... or not,
> as git-rev-parse(1) states:
> 
>   r1^! includes commit r1 but excludes all of its parents.
> 
> So depending on how "r1 --not r1^" and "r1 --not r1^1 r1^2" is
> interpreted by diff (which accpets points, not ranges) it might be, or
> might be not what you wanted by introducying '!' / <rev>:!
> specification...
> 
> -- 
> Jakub Narebski
> Poland
> ShadeHawk on #git
-- 
	David
Previous: Jakub NarebskiNext: Junio C Hamano
Message 9 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.