Improve git-am test coverage
v2 cover Improve git-am test coverage
This is a re-roll of [v1]. Thanks Junio, Johannes, Paolo, Stefan for the reviews last round. Interdiff below.
Previous versions:
[v1] http://thread.gmane.org/gmane.comp.version-control.git/273254
Increase test coverage of git-am.sh to help prevent regressions that could arise from the rewrite of git-am.sh to C. This patch series, along with pt/am-foreign, improved test coverage as measured by kcov from 56.5%[1] to 67.3%[2].
No tests for git-am's interactive mode, though, as test_terminal does not seem to attach a pseudo-tty to stdin(?), thus making git-am's "test -t 0" check fail.
This is part of my GSoC project to rewrite git-am.sh to a C builtin[3].
[1] http://pyokagan.github.io/git/20150430132408-a75942b//kcov-merged/git-am.eb79278e.html
[2] http://pyokagan.github.io/git/20150702173751-2fdae08//kcov-merged/git-am.eb79278e.html
[3] https://gist.github.com/pyokagan/1b7b0d1f4dab6ba3cef1
Paul Tan (12):
t4150: am.messageid really adds the message id
t4150: am fails if index is dirty
t4151: am --abort will keep dirty index intact
t4150: am refuses patches when paused
t4150: am --resolved fails if index has no changes
t4150: am --resolved fails if index has unmerged entries
t4150: am with applypatch-msg hook
t4150: am with pre-applypatch hook
t4150: am with post-applypatch hook
t4150: tests for am --[no-]scissors
t3418: non-interactive rebase --continue with rerere enabled
t3901: test git-am encoding conversion
t/t3418-rebase-continue.sh | 19 ++++ t/t3901-i18n-patch.sh | 62 +++++++++++++ t/t4150-am.sh | 217 +++++++++++++++++++++++++++++++++++++++++++++ t/t4151-am-abort.sh | 15 ++++ 4 files changed, 313 insertions(+)
t/t4150-am.sh +11 -22
@@ -182,9 +182,10 @@ test_expect_success 'am applies patch correctly' ' ' test_expect_success 'am fails if index is dirty' ' - test_when_finished "rm -fr dirtyfile" && + test_when_finished "rm -f dirtyfile" && rm -fr .git/rebase-apply && - git checkout -f first && + git reset --hard && + git checkout first && echo dirtyfile >dirtyfile && git add dirtyfile && test_must_fail git am patch1 &&
@@ -231,12 +232,10 @@ test_expect_success 'am with applypatch-msg hook' ' git reset --hard && git checkout first && mkdir -p .git/hooks && - cat >.git/hooks/applypatch-msg <<-\EOF && - #!/bin/sh + write_script .git/hooks/applypatch-msg <<-\EOF && cat "$1" >actual-msg && echo hook-message >"$1" EOF - chmod +x .git/hooks/applypatch-msg && git am patch1 && test_path_is_missing .git/rebase-apply && git diff --exit-code second &&
@@ -253,11 +252,9 @@ test_expect_success 'am with failing applypatch-msg hook' ' git reset --hard && git checkout first && mkdir -p .git/hooks && - cat >.git/hooks/applypatch-msg <<-\EOF && - #!/bin/sh + write_script .git/hooks/applypatch-msg <<-\EOF && exit 1 EOF - chmod +x .git/hooks/applypatch-msg && test_must_fail git am patch1 && test_path_is_dir .git/rebase-apply && git diff --exit-code first &&
@@ -270,17 +267,14 @@ test_expect_success 'am with pre-applypatch hook' ' git reset --hard && git checkout first && mkdir -p .git/hooks && - cat >.git/hooks/pre-applypatch <<-\EOF && - #!/bin/sh + write_script .git/hooks/pre-applypatch <<-\EOF && git diff first >diff.actual exit 0 EOF - chmod +x .git/hooks/pre-applypatch && git am patch1 && test_path_is_missing .git/rebase-apply && git diff --exit-code second && test_cmp_rev second HEAD && - test_cmp_rev second^ HEAD^ && git diff first..second >diff.expected && test_cmp diff.expected diff.actual '
@@ -291,11 +285,9 @@ test_expect_success 'am with failing pre-applypatch hook' ' git reset --hard && git checkout first && mkdir -p .git/hooks && - cat >.git/hooks/pre-applypatch <<-\EOF && - #!/bin/sh + write_script .git/hooks/pre-applypatch <<-\EOF && exit 1 EOF - chmod +x .git/hooks/pre-applypatch && test_must_fail git am patch1 && test_path_is_dir .git/rebase-apply && git diff --exit-code second &&
@@ -308,13 +300,11 @@ test_expect_success 'am with post-applypatch hook' ' git reset --hard && git checkout first && mkdir -p .git/hooks && - cat >.git/hooks/post-applypatch <<-\EOF && - #!/bin/sh + write_script .git/hooks/post-applypatch <<-\EOF && git rev-parse HEAD >head.actual git diff second >diff.actual exit 0 EOF - chmod +x .git/hooks/post-applypatch && git am patch1 && test_path_is_missing .git/rebase-apply && test_cmp_rev second HEAD &&
@@ -330,12 +320,10 @@ test_expect_success 'am with failing post-applypatch hook' ' git reset --hard && git checkout first && mkdir -p .git/hooks && - cat >.git/hooks/post-applypatch <<-\EOF && - #!/bin/sh + write_script .git/hooks/post-applypatch <<-\EOF && git rev-parse HEAD >head.actual exit 1 EOF - chmod +x .git/hooks/post-applypatch && git am patch1 && test_path_is_missing .git/rebase-apply && git diff --exit-code second &&
@@ -782,7 +770,8 @@ test_expect_success 'am --message-id really adds the message id' ' test_expect_success 'am.messageid really adds the message id' ' rm -fr .git/rebase-apply && - git checkout -f HEAD^ && + git reset --hard && + git checkout HEAD^ && test_config am.messageid true && git am patch1.eml && test_path_is_missing .git/rebase-apply &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 1/12 t4150: am.messageid really adds the message id
Since a078f73 (git-am: add --message-id/--no-message-id, 2014-11-25), the am.messageid setting determines whether the --message-id option is set by default.
Add a test for this.
---
Notes:
v2
* don't use "git checkout -f" as it does not discard unmerged entries. Use "git reset --hard" instead.
t/t4150-am.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+)
t/t4150-am.sh +12 -0
@@ -563,6 +563,18 @@ test_expect_success 'am --message-id really adds the message id' ' test_cmp expected actual ' +test_expect_success 'am.messageid really adds the message id' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout HEAD^ && + test_config am.messageid true && + git am patch1.eml && + test_path_is_missing .git/rebase-apply && + git cat-file commit HEAD | tail -n1 >actual && + grep Message-Id patch1.eml >expected && + test_cmp expected actual +' + test_expect_success 'am --message-id -s signs off after the message id' ' rm -fr .git/rebase-apply && git reset --hard &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 2/12 t4150: am fails if index is dirty
In reply to Paul TanSince d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am will ensure that the index is clean before applying the patch. This is to prevent changes unrelated to the patch from being committed.
Add a test for this check.
---
Notes:
v2
* Should be "rm -f dirtyfile" instead of "rm -rf dirtyfile"
* Don't use "git checkout -f" -- it does not discard unmerged entries. Use git reset --hard instead.
t/t4150-am.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+)
t/t4150-am.sh +12 -0
@@ -154,6 +154,18 @@ test_expect_success 'am applies patch correctly' ' test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)" ' +test_expect_success 'am fails if index is dirty' ' + test_when_finished "rm -f dirtyfile" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + echo dirtyfile >dirtyfile && + git add dirtyfile && + test_must_fail git am patch1 && + test_path_is_dir .git/rebase-apply && + test_cmp_rev first HEAD +' + test_expect_success 'am applies patch e-mail not in a mbox' ' rm -fr .git/rebase-apply && git reset --hard &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 3/12 t4151: am --abort will keep dirty index intact
In reply to Paul TanSince 7b3b7e3 (am --abort: keep unrelated commits since the last failure and warn, 2010-12-21), git-am --abort will not touch the index if on the previous invocation, git-am failed because the index is dirty. This is to ensure that the user's modifications to the index are not discarded.
Add a test for this.
--- t/t4151-am-abort.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
t/t4151-am-abort.sh +15 -0
@@ -95,6 +95,21 @@ test_expect_success 'am --abort will keep the local commits intact' ' test_cmp expect actual ' +test_expect_success 'am --abort will keep dirty index intact' ' + git reset --hard initial && + echo dirtyfile >dirtyfile && + cp dirtyfile dirtyfile.expected && + git add dirtyfile && + test_must_fail git am 0001-*.patch && + test_cmp_rev initial HEAD && + test_path_is_file dirtyfile && + test_cmp dirtyfile.expected dirtyfile && + git am --abort && + test_cmp_rev initial HEAD && + test_path_is_file dirtyfile && + test_cmp dirtyfile.expected dirtyfile +' + test_expect_success 'am -3 stops on conflict on unborn branch' ' git checkout -f --orphan orphan && git reset &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 4/12 t4150: am refuses patches when paused
In reply to Paul TanSince c95b138 (Fix git-am safety checks, 2006-09-15), when there is a session in progress, git-am will check the command-line arguments and standard input to ensure that the user does not pass it any patches.
Add a test for this.
--- t/t4150-am.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
t/t4150-am.sh +14 -0
@@ -397,6 +397,20 @@ test_expect_success 'am --abort removes a stray directory' ' test_path_is_missing .git/rebase-apply ' +test_expect_success 'am refuses patches when paused' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout lorem2^^ && + + test_must_fail git am lorem-move.patch && + test_path_is_dir .git/rebase-apply && + test_cmp_rev lorem2^^ HEAD && + + test_must_fail git am <lorem-move.patch && + test_path_is_dir .git/rebase-apply && + test_cmp_rev lorem2^^ HEAD +' + test_expect_success 'am --resolved works' ' echo goodbye >expected && rm -fr .git/rebase-apply &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 5/12 t4150: am --resolved fails if index has no changes
In reply to Paul TanSince 6d28644 (git-am: do not allow empty commits by mistake., 2006-02-23), git-am --resolved will check to see if the index has any changes to prevent the user from creating an empty commit by mistake.
Add a test for this.
--- t/t4150-am.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+)
t/t4150-am.sh +12 -0
@@ -425,6 +425,18 @@ test_expect_success 'am --resolved works' ' test_cmp expected another ' +test_expect_success 'am --resolved fails if index has no changes' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout lorem2^^ && + test_must_fail git am lorem-move.patch && + test_path_is_dir .git/rebase-apply && + test_cmp_rev lorem2^^ HEAD && + test_must_fail git am --resolved && + test_path_is_dir .git/rebase-apply && + test_cmp_rev lorem2^^ HEAD +' + test_expect_success 'am takes patches from a Pine mailbox' ' rm -fr .git/rebase-apply && git reset --hard &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 6/12 t4150: am --resolved fails if index has unmerged entries
In reply to Paul TanSince c1d1128 (git-am --resolved: more usable error message., 2006-04-28), git-am --resolved will check to see if there are any unmerged entries, and will error out with a user-friendly error message if there are.
Add a test for this.
--- t/t4150-am.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+)
t/t4150-am.sh +13 -0
@@ -437,6 +437,19 @@ test_expect_success 'am --resolved fails if index has no changes' ' test_cmp_rev lorem2^^ HEAD ' +test_expect_success 'am --resolved fails if index has unmerged entries' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout second && + test_must_fail git am -3 lorem-move.patch && + test_path_is_dir .git/rebase-apply && + test_cmp_rev second HEAD && + test_must_fail git am --resolved >err && + test_path_is_dir .git/rebase-apply && + test_cmp_rev second HEAD && + test_i18ngrep "still have unmerged paths" err +' + test_expect_success 'am takes patches from a Pine mailbox' ' rm -fr .git/rebase-apply && git reset --hard &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 7/12 t4150: am with applypatch-msg hook
In reply to Paul TanSince d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am will invoke the applypatch-msg hooks just after extracting the patch message. If the applypatch-msg hook exits with a non-zero status, git-am abort before even applying the patch to the index.
Add tests for this hook.
---
Notes:
v2
* Use write_script() to shave off the shebang line and chmod.
t/t4150-am.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
t/t4150-am.sh +35 -0
@@ -199,6 +199,41 @@ test_expect_success 'am applies patch e-mail with preceding whitespace' ' test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)" ' +test_expect_success 'am with applypatch-msg hook' ' + test_when_finished "rm -f .git/hooks/applypatch-msg" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + mkdir -p .git/hooks && + write_script .git/hooks/applypatch-msg <<-\EOF && + cat "$1" >actual-msg && + echo hook-message >"$1" + EOF + git am patch1 && + test_path_is_missing .git/rebase-apply && + git diff --exit-code second && + echo hook-message >expected && + git log -1 --format=format:%B >actual && + test_cmp expected actual && + git log -1 --format=format:%B second >expected && + test_cmp expected actual-msg +' + +test_expect_success 'am with failing applypatch-msg hook' ' + test_when_finished "rm -f .git/hooks/applypatch-msg" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + mkdir -p .git/hooks && + write_script .git/hooks/applypatch-msg <<-\EOF && + exit 1 + EOF + test_must_fail git am patch1 && + test_path_is_dir .git/rebase-apply && + git diff --exit-code first && + test_cmp_rev first HEAD +' + test_expect_success 'setup: new author and committer' ' GIT_AUTHOR_NAME="Another Thor" && GIT_AUTHOR_EMAIL="[email protected]" &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 8/12 t4150: am with pre-applypatch hook
In reply to Paul TanSince d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am.sg will invoke the pre-applypatch hook after applying the patch to the index, but before a commit is made. Should the hook exit with a non-zero status, git am will exit.
Add tests for this hook.
---
Notes:
v2
* Use write_script() to shave off the shebang line and chmod.
t/t4150-am.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
t/t4150-am.sh +33 -0
@@ -234,6 +234,39 @@ test_expect_success 'am with failing applypatch-msg hook' ' test_cmp_rev first HEAD ' +test_expect_success 'am with pre-applypatch hook' ' + test_when_finished "rm -f .git/hooks/pre-applypatch" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + mkdir -p .git/hooks && + write_script .git/hooks/pre-applypatch <<-\EOF && + git diff first >diff.actual + exit 0 + EOF + git am patch1 && + test_path_is_missing .git/rebase-apply && + git diff --exit-code second && + test_cmp_rev second HEAD && + git diff first..second >diff.expected && + test_cmp diff.expected diff.actual +' + +test_expect_success 'am with failing pre-applypatch hook' ' + test_when_finished "rm -f .git/hooks/pre-applypatch" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + mkdir -p .git/hooks && + write_script .git/hooks/pre-applypatch <<-\EOF && + exit 1 + EOF + test_must_fail git am patch1 && + test_path_is_dir .git/rebase-apply && + git diff --exit-code second && + test_cmp_rev first HEAD +' + test_expect_success 'setup: new author and committer' ' GIT_AUTHOR_NAME="Another Thor" && GIT_AUTHOR_EMAIL="[email protected]" &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 9/12 t4150: am with post-applypatch hook
In reply to Paul TanSince d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am.sh will invoke the post-applypatch hook after the patch is applied and a commit is made. The exit code of the hook is ignored.
Add tests for this hook.
---
Notes:
v2
* use write_script() to shave off the shebang line and chmod
t/t4150-am.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
t/t4150-am.sh +38 -0
@@ -267,6 +267,44 @@ test_expect_success 'am with failing pre-applypatch hook' ' test_cmp_rev first HEAD ' +test_expect_success 'am with post-applypatch hook' ' + test_when_finished "rm -f .git/hooks/post-applypatch" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + mkdir -p .git/hooks && + write_script .git/hooks/post-applypatch <<-\EOF && + git rev-parse HEAD >head.actual + git diff second >diff.actual + exit 0 + EOF + git am patch1 && + test_path_is_missing .git/rebase-apply && + test_cmp_rev second HEAD && + git rev-parse second >head.expected && + test_cmp head.expected head.actual && + git diff second >diff.expected && + test_cmp diff.expected diff.actual +' + +test_expect_success 'am with failing post-applypatch hook' ' + test_when_finished "rm -f .git/hooks/post-applypatch" && + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + mkdir -p .git/hooks && + write_script .git/hooks/post-applypatch <<-\EOF && + git rev-parse HEAD >head.actual + exit 1 + EOF + git am patch1 && + test_path_is_missing .git/rebase-apply && + git diff --exit-code second && + test_cmp_rev second HEAD && + git rev-parse second >head.expected && + test_cmp head.expected head.actual +' + test_expect_success 'setup: new author and committer' ' GIT_AUTHOR_NAME="Another Thor" && GIT_AUTHOR_EMAIL="[email protected]" &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 10/12 t4150: tests for am --[no-]scissors
In reply to Paul TanSince 017678b (am/mailinfo: Disable scissors processing by default, 2009-08-26), git-am supported the --[no-]scissors option, passing it to git-mailinfo.
Add tests to ensure that git-am will pass the --scissors option to git-mailinfo, and that --no-scissors will override the configuration setting of mailinfo.scissors.
--- t/t4150-am.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
t/t4150-am.sh +48 -0
@@ -67,6 +67,19 @@ test_expect_success 'setup: messages' ' EOF + cat >scissors-msg <<-\EOF && + Test git-am with scissors line + + This line should be included in the commit message. + EOF + + cat - scissors-msg >no-scissors-msg <<-\EOF && + This line should not be included in the commit message with --scissors enabled. + + - - >8 - - remove everything above this line - - >8 - - + + EOF + signoff="Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" '
@@ -105,6 +118,20 @@ test_expect_success setup ' git format-patch --stdout first | sed -e "1d" } > patch1-ws.eml && + echo scissors-file >scissors-file && + git add scissors-file && + git commit -F scissors-msg && + git tag scissors && + git format-patch --stdout scissors^ >scissors-patch.eml && + git reset --hard HEAD^ && + + echo no-scissors-file >no-scissors-file && + git add no-scissors-file && + git commit -F no-scissors-msg && + git tag no-scissors && + git format-patch --stdout no-scissors^ >no-scissors-patch.eml && + git reset --hard HEAD^ && + sed -n -e "3,\$p" msg >file && git add file && test_tick &&
@@ -305,6 +332,27 @@ test_expect_success 'am with failing post-applypatch hook' ' test_cmp head.expected head.actual ' +test_expect_success 'am --scissors cuts the message at the scissors line' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout second && + git am --scissors scissors-patch.eml && + test_path_is_missing .git/rebase-apply && + git diff --exit-code scissors && + test_cmp_rev scissors HEAD +' + +test_expect_success 'am --no-scissors overrides mailinfo.scissors' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout second && + test_config mailinfo.scissors true && + git am --no-scissors no-scissors-patch.eml && + test_path_is_missing .git/rebase-apply && + git diff --exit-code no-scissors && + test_cmp_rev no-scissors HEAD +' + test_expect_success 'setup: new author and committer' ' GIT_AUTHOR_NAME="Another Thor" && GIT_AUTHOR_EMAIL="[email protected]" &&
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 11/12 t3418: non-interactive rebase --continue with rerere enabled
In reply to Paul TanSince 8389b52 (git-rerere: reuse recorded resolve., 2006-01-28), git-am will call git-rerere to re-use recorded merge conflict resolutions if any occur in a threeway merge.
Add a test to ensure that git-rerere is called by git-am (which handles the non-interactive rebase).
--- t/t3418-rebase-continue.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
t/t3418-rebase-continue.sh +19 -0
@@ -40,6 +40,25 @@ test_expect_success 'non-interactive rebase --continue works with touched file' git rebase --continue ' +test_expect_success 'non-interactive rebase --continue with rerere enabled' ' + test_config rerere.enabled true && + test_when_finished "test_might_fail git rebase --abort" && + git reset --hard commit-new-file-F2-on-topic-branch && + git checkout master && + rm -fr .git/rebase-* && + + test_must_fail git rebase --onto master master topic && + echo "Resolved" >F2 && + git add F2 && + cp F2 F2.expected && + git rebase --continue && + + git reset --hard commit-new-file-F2-on-topic-branch && + git checkout master && + test_must_fail git rebase --onto master master topic && + test_cmp F2.expected F2 +' + test_expect_success 'rebase --continue can not be used with other options' ' test_must_fail git rebase -v --continue && test_must_fail git rebase --continue -v
Signature · 1 line
2.5.0.rc1.76.gf60a929
PATCH v2 12/12 t3901: test git-am encoding conversion
In reply to Paul TanSince d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am supported the --utf8 and --no-utf8 options, and if set, would pass the -u flag and the -k flag respectively.
git mailinfo -u will re-code the commit log message and authorship info in the charset specified by i18n.commitencoding setting, while git mailinfo -n will disable the re-coding.
Since d84029b (--utf8 is now default for 'git-am', 2007-01-08), --utf8 is set by default in git-am.
Add various encoding conversion tests to t3901 to test git-mailinfo's encoding conversion. In addition, add a test for --no-utf8 to check that no encoding conversion will occur if that option is set.
--- t/t3901-i18n-patch.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
t/t3901-i18n-patch.sh +62 -0
@@ -251,4 +251,66 @@ test_expect_success 'rebase --merge (L/U)' ' check_encoding 2 8859 ' +test_expect_success 'am (U/U)' ' + # Apply UTF-8 patches with UTF-8 commitencoding + git config i18n.commitencoding UTF-8 && + . "$TEST_DIRECTORY"/t3901-utf8.txt && + + git reset --hard master && + git am out-u1 out-u2 && + + check_encoding 2 +' + +test_expect_success 'am (L/L)' ' + # Apply ISO-8859-1 patches with ISO-8859-1 commitencoding + git config i18n.commitencoding ISO8859-1 && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && + + git reset --hard master && + git am out-l1 out-l2 && + + check_encoding 2 8859 +' + +test_expect_success 'am (U/L)' ' + # Apply ISO-8859-1 patches with UTF-8 commitencoding + git config i18n.commitencoding UTF-8 && + . "$TEST_DIRECTORY"/t3901-utf8.txt && + git reset --hard master && + + # am specifies --utf8 by default. + git am out-l1 out-l2 && + + check_encoding 2 +' + +test_expect_success 'am --no-utf8 (U/L)' ' + # Apply ISO-8859-1 patches with UTF-8 commitencoding + git config i18n.commitencoding UTF-8 && + . "$TEST_DIRECTORY"/t3901-utf8.txt && + + git reset --hard master && + git am --no-utf8 out-l1 out-l2 2>err && + + # commit-tree will warn that the commit message does not contain valid UTF-8 + # as mailinfo did not convert it + grep "did not conform" err && + + check_encoding 2 +' + +test_expect_success !MINGW 'am (L/U)' ' + # Apply UTF-8 patches with ISO-8859-1 commitencoding + git config i18n.commitencoding ISO8859-1 && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && + + git reset --hard master && + # mailinfo will re-code the commit message to the charset specified by + # i18n.commitencoding + git am out-u1 out-u2 && + + check_encoding 2 8859 +' + test_done
Signature · 1 line
2.5.0.rc1.76.gf60a929
Hi Paul
Quoted 2 lines · Paul Tan
This is a re-roll of [v1]. Thanks Junio, Johannes, Paolo, Stefan for the reviews last round. Interdiff below.
Interdiff looks good to me!
Thanks,
Dscho