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

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

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 23, 2009, 16:46 UTC
Message-ID
<49C7BCEA.1060309@drmicha.warpmail.net>
In-Reply-To
<20090323163343.GB16258@gmail.com>
David Aguilar venit, vidit, dixit 23.03.2009 17:33:
Show 56 quoted lines
> On  0, Michael J Gruber <git@drmicha.warpmail.net> wrote:
>> 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.
> 
> 
>> 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?

I think both would be useful. Depending on the way it's done, only HEAD~3 maybe be realizable.

> 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.

http://article.gmane.org/gmane.comp.version-control.git/114257 is the newest installment, although http://article.gmane.org/gmane.comp.version-control.git/114076 and especially http://article.gmane.org/gmane.comp.version-control.git/113647 is very worthwhile reading :)

[Isn't there a better way to link to posts? I think I used to take message ids.]

> This is a feature that lots of users would enjoy--I know that
> for sure.
> 
Previous: David AguilarNext: Junio C Hamano
Message 4 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.