Re: [PATCH 08/15] merge: handle NULL value for branch.<name>.mergeOptions
Hi Thomas
On 07/11/2026 08:42, Thomas Bachem via GitGitGadget wrote:
Show 13 quoted lines
> diff --git a/builtin/merge.c b/builtin/merge.c
> index 5b4eb23a83..fbabda97f8 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -668,6 +668,8 @@ static int git_merge_config(const char *k, const char *v,
> skip_prefix(k, "branch.", &str) &&
> skip_prefix(str, branch, &str) &&
> !strcmp(str, ".mergeoptions")) {
> + if (!v)
> + return config_error_nonbool(k);
> free(branch_mergeoptions);
> branch_mergeoptions = xstrdup(v);
> return 0;We treat an empty value differently to a missing value, I'm not sure if that makes sense or not.
Thanks
Phillip
Show 15 quoted lines
> diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
> index 64fe21717d..d4963f1fee 100755
> --- a/t/t7600-merge.sh
> +++ b/t/t7600-merge.sh
> @@ -552,6 +552,12 @@ test_expect_success 'merge c1 with c2 (squash in config)' '
> test_cmp squash.1-5 .git/SQUASH_MSG
> '
> > +test_expect_success 'merge rejects branch.main.mergeOptions without a value' '
> + git reset --hard c1 &&
> + test_must_fail git -c branch.main.mergeOptions merge c2 2>err &&
> + test_grep "missing value for .branch.main.mergeoptions." err
> +'
> +
> test_debug 'git log --graph --decorate --oneline --all'
> > test_expect_success 'override config option -n with --summary' '