diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2012-01-16 16:46:15 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-16 16:26:26 -0800 |
commit | 5a7d5b683f869d3e3884a89775241afa515da9e7 (patch) | |
tree | cf3930dd84c09d9bacdda4c993aab526e7bd493e /t/t5601-clone.sh | |
parent | clone: refuse to clone if --branch points to bogus ref (diff) | |
download | tgif-5a7d5b683f869d3e3884a89775241afa515da9e7.tar.xz |
clone: allow --branch to take a tag
Because a tag ref cannot be put to HEAD, HEAD will become detached.
This is consistent with "git checkout <tag>".
This is mostly useful in shallow clone, where it allows you to clone a
tag in addtion to branches.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5601-clone.sh')
-rwxr-xr-x | t/t5601-clone.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index e0b8db6c53..67869b4813 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -271,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 |