From: Phillip Wood Date: Tue, 10 Nov 2026 11:12:31 GMT Subject: Re: [PATCH 08/15] merge: handle NULL value for branch..mergeOptions Message-ID: <12def237-2d01-404f-b7aa-b4f19e033cdc@gmail.com> In-Reply-To: Hi Thomas On 07/11/2026 08:42, Thomas Bachem via GitGitGadget wrote: > 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 > 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' '