Re: [PATCH 2/4] builtin/rev-parse: learn --null-oid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Denton,

On Fri, Sep 18, 2020 at 04:19:03AM -0700, Denton Liu wrote:
> When a user needed the null OID for scripting purposes, it used to be
> very easy: hardcode 40 zeros. However, since Git started supporting
> SHA-256, this assumption became false which may break some scripts.
> Allow users to fix their broken scripts by providing users with a
> hash-agnostic method of obtaining the null OID.

I have not been very involved in the hash transition, so please take my
comments with a grain of salt (and if they are misplaced, feel free to
ignore them).

This '--null-oid' thing makes me wonder exactly what it does. Yours
gives a type-less object back, but what about scripts that want the OID
of the empty blob or tree?

Would having something like '--null-oid[=<type>]' be useful for them? On
the one hand, it seems like a thing that would be useful, but on the
other, those aren't *the* null OID when 'type' is 'blob' or 'tree'. A
more appropriate name in that case might be '--empty-oid=tree'.

So, that's an argument that '--null-oid' and '--empty-oid[=<type>]'
should be two distinct things. I think I like that best. Do you have any
thoughts about it?

Thanks,
Taylor



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux