Re: [PATCH 2/2] catfile.c: add --batch-command mode
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 5, 2022, 06:52 UTC
- Message-ID
- <CAPig+cTeqhOYTu9WBiY=LnZtt35hAp3Qa5RduC2yLut6p01_1w@mail.gmail.com>
- In-Reply-To
- <3F83E252-D99C-47CB-B47F-11B8EA554A4F@gmail.com>
On Fri, Feb 4, 2022 at 4:42 PM John Cai <johncai86@gmail.com> wrote:
Show 19 quoted lines
> On 4 Feb 2022, at 1:45, Eric Sunshine wrote: > > The `info` and `contents` commands neglect to do any sort of > > validation of their arguments, thus any and all bogus invocations are > > accepted. Thus: > > > > info > > info <arg1> <arg2> > > info <non-oid> > > > > are all accepted as valid invocations, misleadingly producing "<foo> > > missing" messages, rather than erroring out as they should. The "<oid> > > missing" message should be reserved for the case when the lone > > argument to `info` or `contents` is something which looks like a > > legitimate OID. > > So actually the argument to info and contents doesn't have to be an OID but an object name that > eventually gets passed to get_oid_with_context() to resolve to an actual oid. This is the > same behavior as git cat-file --batch and --batch-check, neither of which throws an error. My > goal was to maintain this behavior in --batch-command.
Okay, that makes sense. I was misled by the commit message talking about "<sha1>" in its examples, and didn't do my due diligence by digging more deeply into the existing documentation and code.