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 23, 2009, 16:33 UTC
Message-ID
<20090323163343.GB16258@gmail.com>
In-Reply-To
<49C7A20E.7060503@drmicha.warpmail.net>
On  0, Michael J Gruber <git@drmicha.warpmail.net> wrote:
Show 20 quoted lines
> David Aguilar venit, vidit, dixit 23.03.2009 11:15:
> > 
> > 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.
> > 
> 
> I like the idea of having a shortcut like that a lot, but I'm sorry I'm
> not supportive of a tool-specific rev syntax extension; for principal
> reasons, but also because diff, checkout and maybe others could make
> good use of it.
I completely agree.  I want a convenient shortcut to use everywhere.
Show 13 quoted lines
> Work is underway on clearing out the issue of forbidden characters in
> revision specifiers. We already have commit:file. I think something like
> ~2:file would be short enough as well as in line with the usual
> semantics. Similarly,
> 
> git diff ~3 ~2 file
> git diff ~3 file
> 
> would be short and simple as soon as ~3 is implemented to be a shortcut
> for HEAD~3. (I'm not sure we can actually use ~, even though it would
> fit in with the usual "if it's not specified it's HEAD".) This would
> only need a shortcut for HEAD, such as not even specifying it (as above)
> or c~ with c being our new fancy character for that.

One of my ulterior motives for sending this patch was to start a discussion on this topic. I missed the discussion about clearing out forbidden characters so I'll see if I can find it in the archives. Do you happen to have a link?

Keep in mind that the syntax that this patch added does not have file~3 = HEAD~3. file~3 means finding file as it existed 3 changes-to-file ago, which is != to HEAD~3 if file did not change in the last 3 commits.

It basically runs 'git log -- file' so that only the commits that touch file are considered.

Are you suggesting that ~3:file could be the shortcut for this, or would we need a different syntax since you just said that ~3 would be a shortcut for HEAD~3?

If there's work on syntax-sugarfying diff/checkout/etc. with these kind of shortcuts then I would like to help out with patches, testing, etc.

This is a feature that lots of users would enjoy--I know that for sure.

-- 
	David
Previous: Michael J GruberNext: Michael J Gruber
Message 3 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.