git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* The meaning of x~0 and x~ as rev-spec.
@ 2008-03-14 13:20 Sergei Organov
  2008-03-14 16:24 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Organov @ 2008-03-14 13:20 UTC (permalink / raw)
  To: git

Hello,

Testing suggests that <name>~0 and <name>~ are the same and are just
synonyms for <name> as rev-specs. Is that correct? Is that by design, or
by accident?

Shouldn't <name>~0 have [the same] special meaning as <name>^0?

Shouldn't <name>~ be a short-cut for <name>~1, similar to <name>^?

Anyway, I think that at least <name>~0 (useful for scripting) should be
explicitly documented, provided that <name>^0 has special (and
documented) meaning.

[
The question arose when I wanted to write something like this to
automate reverting of a few last revisions:

  for i in 0 1 2 3; do
      git revert -n HEAD~$i
  done
  git commit -a
]
 
-- Sergei.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The meaning of x~0 and x~ as rev-spec.
  2008-03-14 13:20 The meaning of x~0 and x~ as rev-spec Sergei Organov
@ 2008-03-14 16:24 ` Junio C Hamano
  2008-03-14 17:21   ` Sergei Organov
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2008-03-14 16:24 UTC (permalink / raw)
  To: Sergei Organov; +Cc: git

Sergei Organov <osv@javad.com> writes:

> Testing suggests that <name>~0 and <name>~ are the same and are just
> synonyms for <name> as rev-specs. Is that correct? Is that by design, or
> by accident?

sed -n -e '/name~3/,/x = 0;/p' sha1_name.c

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The meaning of x~0 and x~ as rev-spec.
  2008-03-14 16:24 ` Junio C Hamano
@ 2008-03-14 17:21   ` Sergei Organov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Organov @ 2008-03-14 17:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

> Sergei Organov <osv@javad.com> writes:
>
>> Testing suggests that <name>~0 and <name>~ are the same and are just
>> synonyms for <name> as rev-specs. Is that correct? Is that by design, or
>> by accident?
>
> sed -n -e '/name~3/,/x = 0;/p' sha1_name.c

OK, I'll send a patch for documentation.

-- Sergei.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-14 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 13:20 The meaning of x~0 and x~ as rev-spec Sergei Organov
2008-03-14 16:24 ` Junio C Hamano
2008-03-14 17:21   ` Sergei Organov

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