Re: [PATCH 2/4] builtin/rev-parse: learn --null-oid
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Sep 18, 2020, 18:21 UTC
- Message-ID
- <20200918182150.GC1612043@nand.local>
- In-Reply-To
- <xmqqy2l7kl0p.fsf@gitster.c.googlers.com>
On Fri, Sep 18, 2020 at 11:16:54AM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> Taylor Blau <me@ttaylorr.com> writes: > > > In either case, I think '--zero-oid' makes more sense than '--null-oid' > > (and it matches the tests that are already written). The pair > > '--zero-oid' and '--empty-oid=<type>' make sense to me. > > I am not sure rev-parse should even know about "empty-oid". An end > user or a script who wants to learn what name an empty blob has can > and should ask "git hash-object -t blob --stdin </dev/null".
Yeah, my uncertainty ("should this be '--empty-oid' or '--null-oid'?") is probably a good indication (to me, at least) that the option shouldn't even exist.
Show 7 quoted lines
> I can buy --zero-oid might be handy, but don't see a pressing need > if it is merely to support our test suite and sample hooks. > Instead, something like > > ZERO_OID=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') > > should suffice, no?
Absolutely.
> Take this as a mild indifference, not as a strong rejection.
For what it's worth, I'm probably as indifferent as you. I would be slightly less so if there was evidence of lots of out-of-tree scripts that care about these special OIDs, but I haven't looked too far.
Thanks, Taylor