summaryrefslogtreecommitdiff
path: root/t/t5521-pull-options.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5521-pull-options.sh')
-rwxr-xr-xt/t5521-pull-options.sh55
1 files changed, 45 insertions, 10 deletions
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 159afa7..db00c43 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -2,6 +2,10 @@
test_description='pull options'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
@@ -85,6 +89,13 @@ test_expect_success 'git pull --cleanup errors early on invalid argument' '
test -s err)
'
+test_expect_success 'git pull --no-write-fetch-head fails' '
+ mkdir clonedwfh &&
+ (cd clonedwfh && git init &&
+ test_expect_code 129 git pull --no-write-fetch-head "../parent" >out 2>err &&
+ test_must_be_empty out &&
+ test_grep "no-write-fetch-head" err)
+'
test_expect_success 'git pull --force' '
mkdir clonedoldstyle &&
@@ -92,18 +103,18 @@ test_expect_success 'git pull --force' '
cat >>.git/config <<-\EOF &&
[remote "one"]
url = ../parent
- fetch = refs/heads/master:refs/heads/mirror
+ fetch = refs/heads/main:refs/heads/mirror
[remote "two"]
url = ../parent
- fetch = refs/heads/master:refs/heads/origin
- [branch "master"]
+ fetch = refs/heads/main:refs/heads/origin
+ [branch "main"]
remote = two
- merge = refs/heads/master
+ merge = refs/heads/main
EOF
git pull two &&
test_commit A &&
git branch -f origin &&
- git pull --all --force
+ git pull --no-rebase --all --force
)
'
@@ -117,9 +128,9 @@ test_expect_success 'git pull --all' '
[remote "two"]
url = ../parent
fetch = refs/heads/*:refs/remotes/two/*
- [branch "master"]
+ [branch "main"]
remote = one
- merge = refs/heads/master
+ merge = refs/heads/main
EOF
git pull --all
)
@@ -132,7 +143,7 @@ test_expect_success 'git pull --dry-run' '
cd clonedry &&
git pull --dry-run ../parent &&
test_path_is_missing .git/FETCH_HEAD &&
- test_path_is_missing .git/refs/heads/master &&
+ test_ref_missing refs/heads/main &&
test_path_is_missing .git/index &&
test_path_is_missing file
)
@@ -146,7 +157,7 @@ test_expect_success 'git pull --all --dry-run' '
git remote add origin ../parent &&
git pull --all --dry-run &&
test_path_is_missing .git/FETCH_HEAD &&
- test_path_is_missing .git/refs/remotes/origin/master &&
+ test_ref_missing refs/remotes/origin/main &&
test_path_is_missing .git/index &&
test_path_is_missing file
)
@@ -169,7 +180,7 @@ test_expect_success 'git pull --allow-unrelated-histories' '
(
cd dst &&
test_must_fail git pull ../src side &&
- git pull --allow-unrelated-histories ../src side
+ git pull --no-rebase --allow-unrelated-histories ../src side
)
'
@@ -218,4 +229,28 @@ test_expect_success 'git pull --no-signoff flag cancels --signoff flag' '
test_must_be_empty actual
'
+test_expect_success 'git pull --no-verify flag passed to merge' '
+ test_when_finished "rm -fr src dst actual" &&
+ git init src &&
+ test_commit -C src one &&
+ git clone src dst &&
+ test_hook -C dst commit-msg <<-\EOF &&
+ false
+ EOF
+ test_commit -C src two &&
+ git -C dst pull --no-ff --no-verify
+'
+
+test_expect_success 'git pull --no-verify --verify passed to merge' '
+ test_when_finished "rm -fr src dst actual" &&
+ git init src &&
+ test_commit -C src one &&
+ git clone src dst &&
+ test_hook -C dst commit-msg <<-\EOF &&
+ false
+ EOF
+ test_commit -C src two &&
+ test_must_fail git -C dst pull --no-ff --no-verify --verify
+'
+
test_done