summaryrefslogtreecommitdiff
path: root/t/t5701-clone-local.sh
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2008-02-20 15:10:17 +0000
committerJunio C Hamano <gitster@pobox.com>2008-02-20 11:31:17 -0800
commit5274ba6907cc12d6e6556ff85cb0e4819bd3f730 (patch)
tree93c31367c6441ef73c63ff028c3cd59f03d09456 /t/t5701-clone-local.sh
parentfbd538c262b03d7b096e840a7ef0cdd54c5cea4f (diff)
downloadgit-5274ba6907cc12d6e6556ff85cb0e4819bd3f730.tar.gz
git-clone.sh: properly configure remote even if remote's head is dangling
When cloning a remote repository which's HEAD refers to a nonexistent ref, git-clone cloned all existing refs, but failed to write the configuration for 'remote'. Now it detects the dangling remote HEAD, refuses to checkout any local branch since HEAD refers to nowhere, but properly writes the configuration for 'remote', so that subsequent 'git fetch's don't fail. The problem was reported by Daniel Jacobowitz through http://bugs.debian.org/466581 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5701-clone-local.sh')
-rwxr-xr-xt/t5701-clone-local.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh
index 822ac8c28e..59a165a6d4 100755
--- a/t/t5701-clone-local.sh
+++ b/t/t5701-clone-local.sh
@@ -63,4 +63,12 @@ test_expect_success 'Even without -l, local will make a hardlink' '
test 0 = $copied
'
+test_expect_success 'local clone of repo with nonexistent ref in HEAD' '
+ cd "$D" &&
+ echo "ref: refs/heads/nonexistent" > a.git/HEAD &&
+ git clone a d &&
+ cd d &&
+ git fetch &&
+ test ! -e .git/refs/remotes/origin/HEAD'
+
test_done