* ~ and ^
@ 2007-05-13 18:44 Sean
2007-05-13 19:07 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Sean @ 2007-05-13 18:44 UTC (permalink / raw)
To: git
Would it be possible/reasonable to treat a bare ~3 (or ^) on the git command
line as equivalent to "<current branch>~3" ? At least @{3} already works
this way and it would be nice to do the same for the even more common tilde
and hat operations. If so, it would be a small convenience to just type:
"git show ~3"
Thanks,
Sean
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ~ and ^
2007-05-13 18:44 ~ and ^ Sean
@ 2007-05-13 19:07 ` Junio C Hamano
2007-05-13 19:13 ` Karl Hasselström
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Junio C Hamano @ 2007-05-13 19:07 UTC (permalink / raw)
To: Sean; +Cc: git
Sean <seanlkml@sympatico.ca> writes:
> Would it be possible/reasonable to treat a bare ~3 (or ^) on the git command
> line as equivalent to "<current branch>~3" ? At least @{3} already works
> this way and it would be nice to do the same for the even more common tilde
> and hat operations. If so, it would be a small convenience to just type:
> "git show ~3"
Interesting.
At least, "ls ~0" does not seem to get confused by bash to be
the home directory of the root user, so I do not offhand think
of a reason not to have ~$n as a synonym to HEAD~$n. Would that
be useful? I dunno.
P.S.
Welcome back to the list ;-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ~ and ^
2007-05-13 19:07 ` Junio C Hamano
@ 2007-05-13 19:13 ` Karl Hasselström
2007-05-13 19:49 ` Sean
2007-05-13 19:17 ` Sean
2007-05-13 20:31 ` Robin Rosenberg
2 siblings, 1 reply; 6+ messages in thread
From: Karl Hasselström @ 2007-05-13 19:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sean, git
On 2007-05-13 12:07:21 -0700, Junio C Hamano wrote:
> Sean <seanlkml@sympatico.ca> writes:
>
> > Would it be possible/reasonable to treat a bare ~3 (or ^) on the
> > git command line as equivalent to "<current branch>~3" ? At least
> > @{3} already works this way and it would be nice to do the same
> > for the even more common tilde and hat operations. If so, it would
> > be a small convenience to just type: "git show ~3"
>
> Interesting.
Yes. I think we should have this, even if just for consistency.
> At least, "ls ~0" does not seem to get confused by bash to be the
> home directory of the root user, so I do not offhand think of a
> reason not to have ~$n as a synonym to HEAD~$n.
It seems that ~foo is only expanded to foo's home if there is such a
user. Since all-numeric users probably aren't common, we can probably
get away with it.
> Would that be useful? I dunno.
It would allow you to say
git log ~5..
instead of
git log HEAD~5..
so I'd say it is useful.
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ~ and ^
2007-05-13 19:07 ` Junio C Hamano
2007-05-13 19:13 ` Karl Hasselström
@ 2007-05-13 19:17 ` Sean
2007-05-13 20:31 ` Robin Rosenberg
2 siblings, 0 replies; 6+ messages in thread
From: Sean @ 2007-05-13 19:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Sun, 13 May 2007 12:07:21 -0700
Junio C Hamano <junkio@cox.net> wrote:
> Interesting.
>
> At least, "ls ~0" does not seem to get confused by bash to be
> the home directory of the root user, so I do not offhand think
> of a reason not to have ~$n as a synonym to HEAD~$n. Would that
> be useful? I dunno.
Not going to shake the world but it's a small convenience. Would be
a bit nicer if a lone ~ worked as well without escaping, but I'm not
sure you'd accept a patch to assume "~" whenever git is passed the
users home directory as a lone option ;)
> P.S.
>
> Welcome back to the list ;-)
>
Thanks.
Sean
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ~ and ^
2007-05-13 19:13 ` Karl Hasselström
@ 2007-05-13 19:49 ` Sean
0 siblings, 0 replies; 6+ messages in thread
From: Sean @ 2007-05-13 19:49 UTC (permalink / raw)
To: Karl Hasselström; +Cc: Junio C Hamano, git
On Sun, 13 May 2007 21:13:50 +0200
Karl Hasselström <kha@treskal.com> wrote:
> It seems that ~foo is only expanded to foo's home if there is such a
> user. Since all-numeric users probably aren't common, we can probably
> get away with it.
Someone just mentioned to me that ~# is expanded by Bash if you use the
pushd command to keep a directory stack. So ~1 will stop working
if you use "pushd". Maybe it'd be more confusing than helpful. On the
other hand, there's probably no reason for Git to just give an error
message if it receives a properly escaped lone "~", "~#", or "^".
Sean
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ~ and ^
2007-05-13 19:07 ` Junio C Hamano
2007-05-13 19:13 ` Karl Hasselström
2007-05-13 19:17 ` Sean
@ 2007-05-13 20:31 ` Robin Rosenberg
2 siblings, 0 replies; 6+ messages in thread
From: Robin Rosenberg @ 2007-05-13 20:31 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sean, git
söndag 13 maj 2007 skrev Junio C Hamano:
> Sean <seanlkml@sympatico.ca> writes:
>
> > Would it be possible/reasonable to treat a bare ~3 (or ^) on the git command
> > line as equivalent to "<current branch>~3" ? At least @{3} already works
> > this way and it would be nice to do the same for the even more common tilde
> > and hat operations. If so, it would be a small convenience to just type:
> > "git show ~3"
>
> Interesting.
>
> At least, "ls ~0" does not seem to get confused by bash to be
> the home directory of the root user, so I do not offhand think
> of a reason not to have ~$n as a synonym to HEAD~$n. Would that
> be useful? I dunno.
~0 is my current directory in bash.
$ echo ~0
/home/me/tmp
-- robin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-05-13 20:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-13 18:44 ~ and ^ Sean
2007-05-13 19:07 ` Junio C Hamano
2007-05-13 19:13 ` Karl Hasselström
2007-05-13 19:49 ` Sean
2007-05-13 19:17 ` Sean
2007-05-13 20:31 ` Robin Rosenberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).