summaryrefslogtreecommitdiffstats
path: root/t/t5516-fetch-push.sh
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2024-11-22 13:28:50 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-25 03:46:37 +0100
commit3f763ddf28d28fe63963991513c8db4045eabadc (patch)
tree128738e283defd82ac8e3155745988a41c74937c /t/t5516-fetch-push.sh
parentrefs: add create_only option to refs_update_symref_extended (diff)
downloadgit-3f763ddf28d28fe63963991513c8db4045eabadc.tar.xz
git-3f763ddf28d28fe63963991513c8db4045eabadc.zip
fetch: set remote/HEAD if it does not exist
When cloning a repository remote/HEAD is created, but when the user creates a repository with git init, and later adds a remote, remote/HEAD is only created if the user explicitly runs a variant of "remote set-head". Attempt to set remote/HEAD during fetch, if the user does not have it already set. Silently ignore any errors. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5516-fetch-push.sh')
-rwxr-xr-xt/t5516-fetch-push.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 331778bd42..5a051aa0c7 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1395,7 +1395,8 @@ test_expect_success 'fetch follows tags by default' '
git tag -m "annotated" tag &&
git for-each-ref >tmp1 &&
sed -n "p; s|refs/heads/main$|refs/remotes/origin/main|p" tmp1 |
- sort -k 3 >../expect
+ sed -n "p; s|refs/heads/main$|refs/remotes/origin/HEAD|p" |
+ sort -k 4 >../expect
) &&
test_when_finished "rm -rf dst" &&
git init dst &&