Code

Merge branch 'jc/commit-hook-authorship'
[git.git] / t / t5601-clone.sh
index 87ee01662c2fcfa58d8f9896fd43881e2e7ed7d6..67869b4813dd354f4376ead1470ecb0e58929302 100755 (executable)
@@ -9,10 +9,13 @@ test_expect_success setup '
        rm -fr .git &&
        test_create_repo src &&
        (
-               cd src
-               >file
-               git add file
-               git commit -m initial
+               cd src &&
+               >file &&
+               git add file &&
+               git commit -m initial &&
+               echo 1 >file &&
+               git add file &&
+               git commit -m updated
        )
 
 '
@@ -88,6 +91,26 @@ test_expect_success 'clone --mirror' '
 
 '
 
+test_expect_success 'clone --mirror with detached HEAD' '
+
+       ( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&
+       git clone --mirror src mirror.detached &&
+       ( cd src && git checkout - ) &&
+       GIT_DIR=mirror.detached git rev-parse HEAD >actual &&
+       test_cmp expected actual
+
+'
+
+test_expect_success 'clone --bare with detached HEAD' '
+
+       ( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&
+       git clone --bare src bare.detached &&
+       ( cd src && git checkout - ) &&
+       GIT_DIR=bare.detached git rev-parse HEAD >actual &&
+       test_cmp expected actual
+
+'
+
 test_expect_success 'clone --bare names the local repository <name>.git' '
 
        git clone --bare src &&
@@ -248,4 +271,13 @@ test_expect_success 'clone from original with relative alternate' '
        grep /src/\\.git/objects target-10/objects/info/alternates
 '
 
+test_expect_success 'clone checking out a tag' '
+       git clone --branch=some-tag src dst.tag &&
+       GIT_DIR=src/.git git rev-parse some-tag >expected &&
+       test_cmp expected dst.tag/.git/HEAD &&
+       GIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual &&
+       echo "+refs/heads/*:refs/remotes/origin/*" >fetch.expected &&
+       test_cmp fetch.expected fetch.actual
+'
+
 test_done