format.commitListFormat: strip meaning from empty
The configuration variable format.commitListFormat allows for an empty value. This is unusual and can create issues when interacting with this configuration variable through the CLI. Strip meaning to format.commitListFormat with an empty value. Signed-off-by: Mirko Faina <mroik@delayed.space> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Mirko Faina committed
Mar 23, 2026 at 17:57 UTC
24d174f9917cce804c9057061f7da0dbd3b88a24
2 files changed
+1
-21
builtin/log.c
+1
-10
@@ -1055,17 +1055,8 @@ static int git_format_config(const char *var, const char *value,
1055
return 0;
1056
}
1057
if (!strcmp(var, "format.commitlistformat")) {
1058
- struct strbuf tmp = STRBUF_INIT;
1059
- strbuf_init(&tmp, 0);
1060
- if (value)
1061
- strbuf_addstr(&tmp, value);
1062
- else
1063
- strbuf_addstr(&tmp, "log:[%(count)/%(total)] %s");
1064
-
1058
FREE_AND_NULL(cfg->fmt_cover_letter_commit_list);
1066
- git_config_string(&cfg->fmt_cover_letter_commit_list, var, tmp.buf);
1067
- strbuf_release(&tmp);
1068
- return 0;
1059
+ return git_config_string(&cfg->fmt_cover_letter_commit_list, var, value);
1060
}
1061
if (!strcmp(var, "format.outputdirectory")) {
1062
FREE_AND_NULL(cfg->config_output_directory);
t/t4014-format-patch.sh
-11
@@ -451,17 +451,6 @@ test_expect_success 'cover letter config with count and author' '
451
test_line_count = 2 result
452
'
453
454
-test_expect_success 'cover letter config commitlistformat set but no format' '
455
- test_when_finished "rm -rf patches result" &&
456
- test_when_finished "git config unset format.coverletter" &&
457
- test_when_finished "git config unset format.commitlistformat" &&
458
- git config set format.coverletter true &&
459
- printf "\tcommitlistformat" >> .git/config &&
460
- git format-patch -o patches HEAD~2 &&
461
- grep -E "^[[[:digit:]]+/[[:digit:]]+] .*" patches/0000-cover-letter.patch >result &&
462
- test_line_count = 2 result
463
-'
464
-
454
test_expect_success 'cover letter config commitlistformat set to shortlog' '
455
test_when_finished "rm -rf patches result" &&
456
test_when_finished "git config unset format.coverletter" &&