Thread (68 messages) 68 messages, 7 authors, 2022-02-22

Re: [PATCH 2/2] catfile.c: add --batch-command mode

From: Eric Sunshine <hidden>
Date: 2022-02-05 06:52:40

On Fri, Feb 4, 2022 at 4:42 PM John Cai [off-list ref] wrote:
On 4 Feb 2022, at 1:45, Eric Sunshine wrote:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help