]> git.ipfire.org Git - thirdparty/git.git/commitdiff
format.commitListFormat: strip meaning from empty
authorMirko Faina <mroik@delayed.space>
Mon, 23 Mar 2026 16:57:32 +0000 (17:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Mar 2026 20:06:59 +0000 (13:06 -0700)
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>
builtin/log.c
t/t4014-format-patch.sh

index a7f129d583f0bd944d4722e9ec8a570d06cefab3..47126f906408b76c272f561fa7c771ada6148aac 100644 (file)
@@ -1055,17 +1055,8 @@ static int git_format_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "format.commitlistformat")) {
-               struct strbuf tmp = STRBUF_INIT;
-               strbuf_init(&tmp, 0);
-               if (value)
-                       strbuf_addstr(&tmp, value);
-               else
-                       strbuf_addstr(&tmp, "log:[%(count)/%(total)] %s");
-
                FREE_AND_NULL(cfg->fmt_cover_letter_commit_list);
-               git_config_string(&cfg->fmt_cover_letter_commit_list, var, tmp.buf);
-               strbuf_release(&tmp);
-               return 0;
+               return git_config_string(&cfg->fmt_cover_letter_commit_list, var, value);
        }
        if (!strcmp(var, "format.outputdirectory")) {
                FREE_AND_NULL(cfg->config_output_directory);
index d2a775f78d2cf2688934e96b193a01e8d942b91c..ca37f40a6a180a3ec3418d36c7deaa984a32adb9 100755 (executable)
@@ -451,17 +451,6 @@ test_expect_success 'cover letter config with count and author' '
        test_line_count = 2 result
 '
 
-test_expect_success 'cover letter config commitlistformat set but no format' '
-       test_when_finished "rm -rf patches result" &&
-       test_when_finished "git config unset format.coverletter" &&
-       test_when_finished "git config unset format.commitlistformat" &&
-       git config set format.coverletter true &&
-       printf "\tcommitlistformat" >> .git/config &&
-       git format-patch -o patches HEAD~2 &&
-       grep -E "^[[[:digit:]]+/[[:digit:]]+] .*" patches/0000-cover-letter.patch >result &&
-       test_line_count = 2 result
-'
-
 test_expect_success 'cover letter config commitlistformat set to shortlog' '
        test_when_finished "rm -rf patches result" &&
        test_when_finished "git config unset format.coverletter" &&