Re: git-push segfault
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:21
Jeff King [off-list ref] 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.