From: Eric Sunshine Date: Sat, 05 Feb 2022 06:52:26 GMT Subject: Re: [PATCH 2/2] catfile.c: add --batch-command mode Message-ID: In-Reply-To: <3F83E252-D99C-47CB-B47F-11B8EA554A4F@gmail.com> On Fri, Feb 4, 2022 at 4:42 PM John Cai wrote: > 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 > > info > > > > are all accepted as valid invocations, misleadingly producing " > > missing" messages, rather than erroring out as they should. The " > > 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 "" in its examples, and didn't do my due diligence by digging more deeply into the existing documentation and code.