]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t4014-format-patch.sh
format-patch: print in-body "From" only when needed
[thirdparty/git.git] / t / t4014-format-patch.sh
index 668933bfb2c906ce9f8c74ab498f1986b56aced0..8f272bce84ba605da82dacb04561649f10878df0 100755 (executable)
@@ -1000,6 +1000,16 @@ test_expect_success '--from uses committer ident' '
        test_cmp expect patch.head
 '
 
+test_expect_success '--from omits redundant in-body header' '
+       git format-patch -1 --stdout --from="A U Thor <author@example.com>" >patch &&
+       cat >expect <<-\EOF &&
+       From: A U Thor <author@example.com>
+
+       EOF
+       sed -ne "/^From:/p; /^$/p; /^---$/q" <patch >patch.head &&
+       test_cmp expect patch.head
+'
+
 test_expect_success 'in-body headers trigger content encoding' '
        GIT_AUTHOR_NAME="éxötìc" test_commit exotic &&
        test_when_finished "git reset --hard HEAD^" &&