Re: rev-parse: -- is sometimes a flag and sometimes an arg?
- From
- Tim Hockin <thockin@google.com>
- Date
- Aug 23, 2022, 17:45 UTC
- Message-ID
- <CAO_RewZCjdGcC3fx7pPZEZ9iTk8_Xs7eBqaf8208da3fD=40mA@mail.gmail.com>
- In-Reply-To
- <YwQki4nAEOp4wvv9@tapette.crustytoothpaste.net>
Thanks! That helps a lot.
On Mon, Aug 22, 2022 at 5:51 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:
Show 22 quoted lines
>
> On 2022-08-21 at 00:54:40, Junio C Hamano wrote:
> > Tim Hockin <thockin@google.com> writes:
> >
> > > Sorry, I assumed it was clear, but that was dumb of me.
> > >
> > > I have a string - might be a tag name, might be a branch name, might
> > > be a SHA (complete or partial). I want to resolve that into a
> > > canonical SHA.
> >
> > "git rev-parse --verify string" would insist that 'string' is an
> > object name and show it as an object name to the standard output, or
> > gives an error message and exits with a non-zero status.
>
> Note that this will print a full hex object ID whether it exists in the
> repo or not if one is given (for example, the all-zeros object ID). If
> you want to verify that the object exists, write this:
>
> git rev-parse --verify string^{object}
> --
> brian m. carlson (he/him or they/them)
> Toronto, Ontario, CA