git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rev-parse: -- is sometimes a flag and sometimes an arg?
@ 2022-08-20 22:39 Tim Hockin
  2022-08-20 22:59 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Tim Hockin @ 2022-08-20 22:39 UTC (permalink / raw)
  To: git

```
$ git rev-parse unknown-tag
unknown-tag
fatal: ambiguous argument 'unknown-tag': unknown revision or path not
in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
```

OK

```
$ git rev-parse unknown-tag --
fatal: bad revision 'unknown-tag'
```

Much nicer error.  But:

```
$ git rev-parse HEAD --
113a928239196d0d9f70671517ce917071ceecf6
--
```

That's not very nice.  Why is "--" treated as an arg?

```
$ git rev-parse HEAD
113a928239196d0d9f70671517ce917071ceecf6
```

Looking at rev-parse code it SEEMS to be intentional, but I can't
comprehend why.

Tim

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

end of thread, other threads:[~2022-08-23 19:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-20 22:39 rev-parse: -- is sometimes a flag and sometimes an arg? Tim Hockin
2022-08-20 22:59 ` Junio C Hamano
2022-08-21  0:31   ` Tim Hockin
2022-08-21  0:36     ` Junio C Hamano
2022-08-21  0:39       ` Tim Hockin
2022-08-21  0:54         ` Junio C Hamano
2022-08-23  0:51           ` brian m. carlson
2022-08-23 17:45             ` Tim Hockin

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