From: Junio C Hamano Date: Wed, 24 Feb 2010 19:26:10 GMT Subject: Re: git-push segfault Message-ID: <7vljeio2p9.fsf@alter.siamese.dyndns.org> In-Reply-To: <20100224170853.GA4756@coredump.intra.peff.net> Jeff King writes: > ... On > the other hand, branch->merge_name _does_ have one element, so perhaps > it is an error in the caller to assume that branch->merge_nr and > branch->merge necessarily correspond. I think this is a sensible thing to do. branch_has_merge_config() could be used here but I do not see a point, as the code already knows branch is non NULL and there are many other places that checks !!branch->merge themselves. It may be worth adding a helper function that a caller can lazily sanity check the set of configuration around a given branch, but that sanity check will probably go way beyond what branch_has_merge_config() currently does, so I would think that would be a separate patch after somebody audits what current non-users of branch_has_merge_config() want. For example, builtin-branch.c not only makes sure branch->merge is non NULL but also wants branch->merge[0] and branch->merge[0]->dst exists, and encapsulating only the first two out of four checks it does by using branch_has_merge_config() does not add much value to it.. Thanks.