summaryrefslogtreecommitdiff
path: root/t/t5401-update-hooks.sh
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2020-11-18 23:44:29 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-11-19 15:44:18 -0800
commit966b4be2765a9bd80febfd4660a1fa9e6408d143 (patch)
tree9fd8b1a1ddffac53a9e9f8209475f8f8f26b9554 /t/t5401-update-hooks.sh
parentt5323: prepare centered comment for `master` -> `main` (diff)
downloadtgif-966b4be2765a9bd80febfd4660a1fa9e6408d143.tar.xz
t5[0-4]*: adjust the references to the default branch name "main"
Carefully excluding t5310, which is developed independently of the current patch series at the time of writing, we now use `main` as default branch in t5[0-4]*. This trick was performed via $ (cd t && sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \ -e 's/Master/Main/g' -- t5[0-4]*.sh && git checkout HEAD -- t5310\*) This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5401-update-hooks.sh')
-rwxr-xr-xt/t5401-update-hooks.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
index 956d69f5b1..6012cc8172 100755
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
@@ -15,11 +15,11 @@ 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 update-ref refs/heads/tofail $commit1 &&
git clone --bare ./. victim.git &&
GIT_DIR=victim.git git update-ref refs/heads/tofail $commit1 &&
- git update-ref refs/heads/master $commit1 &&
+ git update-ref refs/heads/main $commit1 &&
git update-ref refs/heads/tofail $commit0
'
@@ -38,7 +38,7 @@ echo "$@" >>$GIT_DIR/update.args
read x; printf %s "$x" >$GIT_DIR/update.stdin
echo STDOUT update $1
echo STDERR update $1 >&2
-test "$1" = refs/heads/master || exit
+test "$1" = refs/heads/main || exit
EOF
chmod u+x victim.git/hooks/update
@@ -62,11 +62,11 @@ chmod u+x victim.git/hooks/post-update
test_expect_success push '
test_must_fail git send-pack --force ./victim.git \
- master tofail >send.out 2>send.err
+ main tofail >send.out 2>send.err
'
test_expect_success 'updated as expected' '
- test $(GIT_DIR=victim.git git rev-parse master) = $commit1 &&
+ test $(GIT_DIR=victim.git git rev-parse main) = $commit1 &&
test $(GIT_DIR=victim.git git rev-parse tofail) = $commit1
'
@@ -82,24 +82,24 @@ test_expect_success 'hooks ran' '
'
test_expect_success 'pre-receive hook input' '
- (echo $commit0 $commit1 refs/heads/master &&
+ (echo $commit0 $commit1 refs/heads/main &&
echo $commit1 $commit0 refs/heads/tofail
) | test_cmp - victim.git/pre-receive.stdin
'
test_expect_success 'update hook arguments' '
- (echo refs/heads/master $commit0 $commit1 &&
+ (echo refs/heads/main $commit0 $commit1 &&
echo refs/heads/tofail $commit1 $commit0
) | test_cmp - victim.git/update.args
'
test_expect_success 'post-receive hook input' '
- echo $commit0 $commit1 refs/heads/master |
+ echo $commit0 $commit1 refs/heads/main |
test_cmp - victim.git/post-receive.stdin
'
test_expect_success 'post-update hook arguments' '
- echo refs/heads/master |
+ echo refs/heads/main |
test_cmp - victim.git/post-update.args
'
@@ -120,8 +120,8 @@ test_expect_success 'send-pack produced no output' '
cat <<EOF >expect
remote: STDOUT pre-receive
remote: STDERR pre-receive
-remote: STDOUT update refs/heads/master
-remote: STDERR update refs/heads/master
+remote: STDOUT update refs/heads/main
+remote: STDERR update refs/heads/main
remote: STDOUT update refs/heads/tofail
remote: STDERR update refs/heads/tofail
remote: error: hook declined to update refs/heads/tofail
@@ -143,7 +143,7 @@ test_expect_success 'pre-receive hook that forgets to read its input' '
for v in $(test_seq 100 999)
do
- git branch branch_$v master || return
+ git branch branch_$v main || return
done &&
git push ./victim.git "+refs/heads/*:refs/heads/*"
'