path: root/t/
diff options
authorJeff King <>2011-06-03 05:11:13 (GMT)
committerJunio C Hamano <>2011-06-06 00:53:10 (GMT)
commit61adfd30974a6c49b3d07275e9f2c9fc44bf779c (patch)
treefa3479c921c9e30ae8af63586f088e2b9ff7850b /t/
parent3b368546a0da81aa44d8c46eb40a7e7b955cab65 (diff)
consider only branches in guess_remote_head
The guess_remote_head function tries to figure out where a remote's HEAD is pointing by comparing the sha1 of the remote's HEAD with the sha1 of various refs found on the remote. However, we were too liberal in matching refs, and would match tags or remote tracking branches, even though these things could not possibly be referenced by the HEAD symbolic ref (since git will detach when checking them out). As a result, a clone of a remote repository with a detached HEAD might write "refs/tags/*" into our local HEAD, which is bogus. The resulting HEAD should be detached. The other related code path is remote.c's get_head_names() (which is used for, among other things, "set-head -a"). This was not affected, however, as that function feeds only refs from refs/heads to guess_remote_head. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 1 insertions, 1 deletions
diff --git a/t/ b/t/
index 6cecd4c..d63b1e3 100755
--- a/t/
+++ b/t/
@@ -41,7 +41,7 @@ test_expect_success 'cloned HEAD matches' '
git --git-dir=detached-tag/.git log -1 --format=%s >actual &&
test_cmp expect actual
-test_expect_failure 'cloned HEAD is detached' '
+test_expect_success 'cloned HEAD is detached' '
head_is_detached detached-tag