Re: [PATCH] difftool: add support for an extended revision syntax
From: David Aguilar <hidden>
Date: 2016-06-15 22:46:27
On 0, Michael J Gruber [off-list ref] wrote:
David Aguilar venit, vidit, dixit 23.03.2009 11:15:quoted
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? 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