diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-02-17 15:33:37 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-02-17 15:43:09 -0800 |
| commit | 50bebf98d96a6ccf2ca5c76da5dd8afff6933a4c (patch) | |
| tree | 3c5b3e93f843a32c2eff9cccce393cc0267b56ef /t | |
| parent | d9d677b2d8cc5f70499db04e633ba7a400f64cbf (diff) | |
format.attach: allow empty value to disable multi-part messages
When a lower precedence configuration file (e.g. /etc/gitconfig)
defines format.attach in any way, there was no way to disable it in
a more specific configuration file (e.g. $HOME/.gitconfig).
Change the behaviour of setting it to an empty string. It used to
mean that the result is still a multipart message with only dashes
used as a multi-part separator, but now it resets the setting to
the default (which would be to give an inline patch, unless other
command line options are in effect).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rwxr-xr-x | t/t4014-format-patch.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 012f155e10..f3313b8c58 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -2281,6 +2281,24 @@ test_expect_success 'format-patch --attach cover-letter only is non-multipart' ' test_line_count = 1 output ' +test_expect_success 'format-patch with format.attach' ' + test_when_finished "rm -fr patches" && + separator=attachment-separator && + test_config format.attach "$separator" && + filename=$(git format-patch -o patches -1) && + grep "^Content-Type: multipart/.*$separator" "$filename" +' + +test_expect_success 'format-patch with format.attach=disabled' ' + test_when_finished "rm -fr patches" && + separator=attachment-separator && + test_config_global format.attach "$separator" && + test_config format.attach "" && + filename=$(git format-patch -o patches -1) && + # The output should not even declare content type for text/plain. + ! grep "^Content-Type: multipart/" "$filename" +' + test_expect_success '-c format.mboxrd format-patch' ' sp=" " && cat >msg <<-INPUT_END && |
