Re: [PATCH 2/4] builtin/rev-parse: learn --null-oid
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Sep 20, 2020, 15:35 UTC
- Message-ID
- <20200920153537.GA2726066@nand.local>
- In-Reply-To
- <20200918212609.GC67496@camp.crustytoothpaste.net>
On Fri, Sep 18, 2020 at 09:26:09PM +0000, brian m. carlson wrote:
Show 11 quoted lines
> What I typically do when I write shell scripts, and which may obviate > the need for this patch is turn this: > > [ "$oid" = 0000000000000000000000000000000000000000 ] > > into this: > > echo "$oid" | grep -qsE '^0+$' > > This is slightly less efficient, but it's also backwards compatible > with older Git version assuming you have a POSIX grep.
Yeah, I mostly just have no idea how common this is in the wild. If many scripts care about the null OID, then a '--null-oid' makes sense to me. But if it's only a few, then it does not.
Show 5 quoted lines
> If you still want this option, then that's fine, but please make > --null-oid take the same arguments as --show-object-format (and default > to the same value). Git will soon learn about writing SHA-1 while > storing in SHA-256, and it makes everyone's life better if we can plan > for the future by making it understand these options now.
Agreed.
Show 7 quoted lines
> I'm not sure we need an empty tree and empty blob object, because it's > pretty easy to write these: > > git hash-object -t tree /dev/null > git hash-object -t blob /dev/null > > That's what I've done in some of the transition code at least.
I could go either way. This for some reason seems more common to me, so I wouldn't mind making it easier for callers, but I don't care so much because what you already wrote is easy enough as-is.
> -- > brian m. carlson: Houston, Texas, US
Thanks, Taylor