Re: [PATCH 2] Add default merge options for all branches
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 2, 2011, 23:36 UTC
- Message-ID
- <7voc3kk748.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <4DBF04C5.1080608@dailyvoid.com>
Michael Grubb <devel@dailyvoid.com> writes:
Show 12 quoted lines
> diff --git a/builtin/merge.c b/builtin/merge.c
> index 0bdd19a..9e5b6bd 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -505,9 +505,18 @@ cleanup:
>
> static int git_merge_config(const char *k, const char *v, void *cb)
> {
> - if (branch && !prefixcmp(k, "branch.") &&
> - !prefixcmp(k + 7, branch) &&
> - !strcmp(k + 7 + strlen(branch), ".mergeoptions")) {
> + static int branch_merge_options_set = 0;I prefer to avoid "static int" that you cannot easily clear here. It would make it impossible to call the function twice.
I think it is easily doable by using the callback parameter (cb).
I am also wondering how this will scale, both in the direction of "later it is likely that we would want to support a glob not just '*' here", and also "later it is likely that we would want to support other per-branch variables, not just "mergeoptions" here".