aboutsummaryrefslogtreecommitdiffstats
path: root/t/t5510-fetch.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5510-fetch.sh')
-rwxr-xr-xt/t5510-fetch.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 7a7818006e..ebc696546b 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -125,7 +125,10 @@ test_expect_success "fetch test followRemoteHEAD never" '
cd two &&
git update-ref --no-deref -d refs/remotes/origin/HEAD &&
git config set remote.origin.followRemoteHEAD "never" &&
- git fetch &&
+ GIT_TRACE_PACKET=$PWD/trace.out git fetch &&
+ # Confirm that we do not even ask for HEAD when we are
+ # not going to act on it.
+ test_grep ! "ref-prefix HEAD" trace.out &&
test_must_fail git rev-parse --verify refs/remotes/origin/HEAD
)
'
@@ -256,6 +259,20 @@ test_expect_success "fetch test followRemoteHEAD always" '
)
'
+test_expect_success 'followRemoteHEAD does not kick in with refspecs' '
+ test_when_finished "git config unset remote.origin.followRemoteHEAD" &&
+ (
+ cd "$D" &&
+ cd two &&
+ git remote set-head origin other &&
+ git config set remote.origin.followRemoteHEAD always &&
+ git fetch origin refs/heads/main:refs/remotes/origin/main &&
+ echo refs/remotes/origin/other >expect &&
+ git symbolic-ref refs/remotes/origin/HEAD >actual &&
+ test_cmp expect actual
+ )
+'
+
test_expect_success 'fetch --prune on its own works as expected' '
cd "$D" &&
git clone . prune &&