From: Chris Packham Date: Fri, 05 Sep 2014 10:06:50 GMT Subject: [RFC PATCHv3 3/4] t/am: add tests for hg patch format Message-ID: <1409911611-20370-4-git-send-email-judge.packham@gmail.com> In-Reply-To: <1409911611-20370-1-git-send-email-judge.packham@gmail.com> This adds a tests which exercise the detection of the hg format. As with stgit there is a current know breakage in where split_patches can't handle reading from stdin with these patch formats. Cc: Giuseppe Bilotta Signed-off-by: Chris Packham --- Note. I don't have access to a mercurial repository (plus I know next to nothing about it) so the patch I've generated for the test was created by looking at the format detection code. If someone can show me an actual example of what mercurial produces that'd be helpful. t/t4150-am.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/t/t4150-am.sh b/t/t4150-am.sh index dbe3475..8ee81cf 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -112,6 +112,14 @@ test_expect_success setup ' echo "---" && git diff-tree --stat -p second | sed -e "1d" } > patch1-stgit.eml && + { + echo "# HG changeset patch" + echo "# User $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" + echo && + cat msg && + echo "---" && + git diff-tree --stat -p second | sed -e "1d" + } > patch1-hg.eml && sed -n -e "3,\$p" msg >file && git add file && @@ -213,6 +221,24 @@ test_expect_failure 'am applies patch using --patch-format=stgit' ' git diff --exit-code second ' +test_expect_success 'am applies patch generated by hg' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + git am patch1-hg.eml && + test_path_is_missing .git/rebase-apply && + git diff --exit-code second +' + +test_expect_failure 'am applies patch using --patch-format=hg' ' + rm -fr .git/rebase-apply && + git reset --hard && + git checkout first && + git am --patch-format=hg