diff options
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-x | t/t4014-format-patch.sh | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index b653dd7d44..958c2da56e 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -81,16 +81,16 @@ test_expect_success 'format-patch --ignore-if-in-upstream handles tags' ' ' test_expect_success "format-patch doesn't consider merge commits" ' - git checkout -b slave master && + git checkout -b feature master && echo "Another line" >>file && test_tick && - git commit -am "Slave change #1" && + git commit -am "Feature branch change #1" && echo "Yet another line" >>file && test_tick && - git commit -am "Slave change #2" && + git commit -am "Feature branch change #2" && git checkout -b merger master && test_tick && - git merge --no-ff slave && + git merge --no-ff feature && git format-patch -3 --stdout >patch && grep "^From " patch >from && test_line_count = 3 from @@ -1161,6 +1161,59 @@ test_expect_success 'format-patch wraps extremely long from-header (rfc2047)' ' ' cat >expect <<'EOF' +From: Foö Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar + Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo + Bar Foo Bar Foo Bar Foo Bar <author@example.com> +EOF +test_expect_success 'format-patch wraps extremely long from-header (non-ASCII without Q-encoding)' ' + echo content >>file && + git add file && + GIT_AUTHOR_NAME="Foö Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar" \ + git commit -m author-check && + git format-patch --no-encode-email-headers --stdout -1 >patch && + sed -n "/^From: /p; /^ /p; /^$/q" patch >actual && + test_cmp expect actual +' + +cat >expect <<'EOF' +Subject: [PATCH] Foö +EOF +test_expect_success 'subject lines are unencoded with --no-encode-email-headers' ' + echo content >>file && + git add file && + git commit -m "Foö" && + git format-patch --no-encode-email-headers -1 --stdout >patch && + grep ^Subject: patch >actual && + test_cmp expect actual +' + +cat >expect <<'EOF' +Subject: [PATCH] Foö +EOF +test_expect_success 'subject lines are unencoded with format.encodeEmailHeaders=false' ' + echo content >>file && + git add file && + git commit -m "Foö" && + git config format.encodeEmailHeaders false && + git format-patch -1 --stdout >patch && + grep ^Subject: patch >actual && + test_cmp expect actual +' + +cat >expect <<'EOF' +Subject: [PATCH] =?UTF-8?q?Fo=C3=B6?= +EOF +test_expect_success '--encode-email-headers overrides format.encodeEmailHeaders' ' + echo content >>file && + git add file && + git commit -m "Foö" && + git config format.encodeEmailHeaders false && + git format-patch --encode-email-headers -1 --stdout >patch && + grep ^Subject: patch >actual && + test_cmp expect actual +' + +cat >expect <<'EOF' Subject: header with . in it EOF test_expect_success 'subject lines do not have 822 atom-quoting' ' @@ -1549,6 +1602,19 @@ test_expect_success 'format patch ignores color.ui' ' test_cmp expect actual ' +test_expect_success 'format patch respects diff.relative' ' + rm -rf subdir && + mkdir subdir && + echo other content >subdir/file2 && + git add subdir/file2 && + git commit -F msg && + test_unconfig diff.relative && + git format-patch --relative=subdir --stdout -1 >expect && + test_config diff.relative true && + git -C subdir format-patch --stdout -1 >actual && + test_cmp expect actual +' + test_expect_success 'cover letter with invalid --cover-from-description and config' ' test_config branch.rebuild-1.description "config subject |