From: Junio C Hamano Date: Tue, 03 Jul 2012 20:21:36 GMT Subject: Re: [PATCH v4 00/18] Extending the shelf-life of "git describe" output Message-ID: <7vtxxotx2n.fsf@alter.siamese.dyndns.org> In-Reply-To: <20120703193410.GA20503@sigill.intra.peff.net> Jeff King writes: > What happens if I set multiple flags? One or more of them will be > ignored (you _could_ try to establish a hierarchy, for example that > TREEISH is a superset of COMMITISH, but that could not handle the *_only > cases, which really are mutually exclusive). IOW, I think these are not > really flags but rather enum elements. Yes, I was aware of that. I counted five useful ones (see the new ones near the tip of 'pu') but there may be others, so you cannot fit in 2 bits and would need 3 bits. > It is probably an OK trade-off since we are also stuffing true flags > like GET_SHA1_QUIETLY in the same field, and we don't want to make the > parameter list too unwieldy by splitting out the enum. But it might be > worth throwing a comment into cache.h that a certain set of the flags > are mutually exclusive. Or I guess you could mask off that part and make > sure only one bit was set, which would catch the error at run-time. But > I think a comment is probably sufficient. I actually am thinking to move these bit assignments backto sha1_name.c and make them private, as get_sha1_tree() and friends are easier to understand public interface functions than get_sha1_typish(... I_WANT_COMMIT|I_WANT_COMMITTISH|...).