From: Taylor Blau Date: Fri, 18 Sep 2020 14:11:25 GMT Subject: Re: [PATCH 2/4] builtin/rev-parse: learn --null-oid Message-ID: <20200918141125.GB1602321@nand.local> In-Reply-To: <004f2e4c92918a7a4e452d49e98ef15f1c5ac545.1600427894.git.liu.denton@gmail.com> 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[=]' 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[=]' should be two distinct things. I think I like that best. Do you have any thoughts about it? Thanks, Taylor