[PATCH 1/3] t4150-am: demonstrate git-am's failure to handle some patch emails
- From
Brandon Casey <casey@nrlssc.navy.mil>
- Date
- Aug 7, 2009, 01:08 UTC
- Message-ID
- <COrzR9ThNBy5SQ7chsXyUOUuBmX-VWMCz3MUVwvBOlIZzlIXRRMP6EMS7BRy_6uJvxt5H-FbtdY@cipher.nrlssc.navy.mil>
- In-Reply-To
- <MEhvdM_GHnyaFj9ZU3lxKS47vmOk5BKslGm0FxkE_lg0SQT5Zx6KhA@cipher.nrlssc.navy.mil>
From: Brandon Casey <drafnel@gmail.com>
Recently git-am gained the ability to detect and apply patches from some foreign VCS's. The detection of traditional patch emails though is somewhat limited and will fail if a "From" field is not detected in the first three lines of the email header. Demonstrate the failure by supplying a perfectly valid email to git-am which it formerly could successfully apply.
Signed-off-by: Brandon Casey <drafnel@gmail.com> --- t/t4150-am.sh | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh index a12bf84..ad2a85f 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -77,6 +77,12 @@ test_expect_success setup ' git commit -s -F msg && git tag second && git format-patch --stdout first >patch1 && + { + echo "X-Fake-Field: Line One" && + echo "X-Fake-Field: Line Two" && + echo "X-Fake-Field: Line Three" && + git format-patch --stdout first | sed -e "1d" + } > patch1.eml && sed -n -e "3,\$p" msg >file && git add file && test_tick && @@ -108,6 +114,15 @@ test_expect_success 'am applies patch correctly' ' test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)" ' +test_expect_failure 'am correctly applies patch from email lacking "From" in first 3 lines' ' + git checkout first && + git am patch1.eml && + ! test -d .git/rebase-apply && + test -z "$(git diff second)" && + test "$(git rev-parse second)" = "$(git rev-parse HEAD)" && + test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)" +' + GIT_AUTHOR_NAME="Another Thor" GIT_AUTHOR_EMAIL="a.thor@example.com" GIT_COMMITTER_NAME="Co M Miter"
-- 1.6.4