Thread (6 messages) 6 messages, 3 authors, 2016-06-15

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

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:46:27

David Aguilar venit, vidit, dixit 23.03.2009 17:33:
On  0, Michael J Gruber [off-list ref] wrote:
quoted
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.

quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help