]> git.ipfire.org Git - thirdparty/git.git/commit
t: add tests for cloning remotes with detached HEAD
authorJeff King <peff@peff.net>
Fri, 3 Jun 2011 05:10:10 +0000 (01:10 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jun 2011 00:53:01 +0000 (17:53 -0700)
commit3b368546a0da81aa44d8c46eb40a7e7b955cab65
treeb37faae518eae74b0ca15497dd97ce1ca431991c
parentbac9c06ba093d9254cb2ab3eed074722a3e635a6
t: add tests for cloning remotes with detached HEAD

We didn't test this setup at all, and doing so reveals a few
bugs:

  1. Cloning a repository with an orphaned detached HEAD
     (i.e., one that points to history that is not
     referenced by any ref) will fail.

  2. Cloning a repository with a detached HEAD that points
     to a tag will cause us to write a bogus "refs/tags/..."
     ref into the HEAD symbolic ref. We should probably
     detach instead.

  3. Cloning a repository with a detached HEAD that points
     to a branch will cause us to checkout that branch. This
     is a known limitation of the git protocol (we have to
     guess at HEAD's destination, since the symref contents
     aren't shown to us). This test serves to document the
     desired behavior, which can only be achieved once the
     git protocol learns to share symref information.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5707-clone-detached.sh [new file with mode: 0755]