From: Jacob Keller Date: Fri, 19 Aug 2016 20:35:51 GMT Subject: Re: [PATCH v8 7/8] cache: add empty_tree_oid object Message-ID: In-Reply-To: On Fri, Aug 19, 2016 at 1:31 PM, Junio C Hamano wrote: > Jacob Keller writes: > >> From: Jacob Keller >> >> Add an empty_tree_oid object which can be used in place of >> EMPTY_TREE_SHA1_BIN_LITERAL for code which is being converted to struct >> object_id. > > How widely do you envision the users of this symbol would be spread > across the entire codebase? I am debating myself if we need a > singleton in-core copy like this (if we end up referring to it from > everywhere), or we only need one level higher abstraction, > e.g. "is_empty_tree_oid()" helper (in which case I do not think we > even need a singleton; just imitate how is_empty_blob_sha1() is > implemented). If I do this, I'd also add an "is_empty_tree_sha1()" as well? > > Even if we need such a singleton, I think we avoid ".field = value" > struct initializations in our code. > Is there a reason for that? I've found that .field = value is safer because it ensures that you don't end up initializing the wrong values? Or is it a compatibility thing? Thanks, Jake