diff options
Diffstat (limited to 't/t5402-post-merge-hook.sh')
-rwxr-xr-x | t/t5402-post-merge-hook.sh | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh index 6eb2ffd6ec..3e5e19c719 100755 --- a/t/t5402-post-merge-hook.sh +++ b/t/t5402-post-merge-hook.sh @@ -4,6 +4,9 @@ # test_description='Test the post-merge hook.' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./test-lib.sh test_expect_success setup ' @@ -15,7 +18,7 @@ test_expect_success setup ' git update-index a && tree1=$(git write-tree) && commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && - git update-ref refs/heads/master $commit0 && + git update-ref refs/heads/main $commit0 && git clone ./. clone1 && GIT_DIR=clone1/.git git update-index --add a && git clone ./. clone2 && @@ -23,34 +26,34 @@ test_expect_success setup ' ' for clone in 1 2; do - cat >clone${clone}/.git/hooks/post-merge <<'EOF' + cat >clone${clone}/.git/hooks/post-merge <<'EOF' #!/bin/sh echo $@ >> $GIT_DIR/post-merge.args EOF - chmod u+x clone${clone}/.git/hooks/post-merge + chmod u+x clone${clone}/.git/hooks/post-merge done test_expect_success 'post-merge does not run for up-to-date ' ' - GIT_DIR=clone1/.git git merge $commit0 && + GIT_DIR=clone1/.git git merge $commit0 && ! test -f clone1/.git/post-merge.args ' test_expect_success 'post-merge runs as expected ' ' - GIT_DIR=clone1/.git git merge $commit1 && + GIT_DIR=clone1/.git git merge $commit1 && test -e clone1/.git/post-merge.args ' test_expect_success 'post-merge from normal merge receives the right argument ' ' - grep 0 clone1/.git/post-merge.args + grep 0 clone1/.git/post-merge.args ' test_expect_success 'post-merge from squash merge runs as expected ' ' - GIT_DIR=clone2/.git git merge --squash $commit1 && + GIT_DIR=clone2/.git git merge --squash $commit1 && test -e clone2/.git/post-merge.args ' test_expect_success 'post-merge from squash merge receives the right argument ' ' - grep 1 clone2/.git/post-merge.args + grep 1 clone2/.git/post-merge.args ' test_done |