Skip to content

Commit 2f2c26d

Browse files
Mroikgitster
authored andcommitted
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 interface. 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>
1 parent 7347b62 commit 2f2c26d

2 files changed

Lines changed: 1 addition & 21 deletions

File tree

builtin/log.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,17 +1055,8 @@ static int git_format_config(const char *var, const char *value,
10551055
return 0;
10561056
}
10571057
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-
10651058
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);
10691060
}
10701061
if (!strcmp(var, "format.outputdirectory")) {
10711062
FREE_AND_NULL(cfg->config_output_directory);

t/t4014-format-patch.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -451,17 +451,6 @@ test_expect_success 'cover letter config with count and author' '
451451
test_line_count = 2 result
452452
'
453453

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-
465454
test_expect_success 'cover letter config commitlistformat set to shortlog' '
466455
test_when_finished "rm -rf patches result" &&
467456
test_when_finished "git config unset format.coverletter" &&

0 commit comments

Comments
 (0)