diff options
author | Paul Tan <pyokagan@gmail.com> | 2015-07-19 23:49:15 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-07-20 10:52:28 -0700 |
commit | 3ef4446bf23f7c7ecafb275f833b155608484146 (patch) | |
tree | 98f35d2eb9f8596e0b83d54a86e0e90ecf788b08 /t | |
parent | 3bc6686b8687e3aa0331b37464ce25b609c3ec88 (diff) | |
download | git-3ef4446bf23f7c7ecafb275f833b155608484146.tar.gz git-3ef4446bf23f7c7ecafb275f833b155608484146.tar.xz |
t4150: am with post-applypatch hook
Since 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.
Helped-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t4150-am.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 957c63c76..749424042 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -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="a.thor@example.com" && |