Bug 419649 - CLI clone fails to checkout a tag
Summary: CLI clone fails to checkout a tag
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 398513
  Show dependency tree
 
Reported: 2013-10-16 20:26 EDT by Mykola Nikishov CLA
Modified: 2014-04-25 19:02 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mykola Nikishov CLA 2013-10-16 20:26:23 EDT
According to 'man git-clone' [1], it should be possible to clone repository and checkout a tag:

--branch <name>
-b <name>

    ... --branch can also take tags and detaches the HEAD at that
    commit in the resulting repository.

> git clone --branch v3.0.0.201306101825-r https://git.eclipse.org/r/egit/egit tmp/git-clone-tag-egit
Cloning into 'tmp/git-clone-tag-egit'...
remote: Counting objects: 49920, done
remote: Finding sources: 100% (49920/49920)
remote: Total 49920 (delta 21587), reused 43550 (delta 21587)
Receiving objects: 100% (49920/49920), 36.64 MiB | 461.00 KiB/s, done.
Resolving deltas: 100% (21587/21587), done.
Checking connectivity... done
Note: checking out 'f85dc228e3e67b229c978f751a8723a5c810738b'.

> git --version 
git version 1.8.4

But JGit fails for the same args:

> jgit clone --branch v3.0.0.201306101825-r https://git.eclipse.org/r/egit/egit tmp/jgit-clone-tag-egit
Initialized empty Git repository in /home/mn/tmp/jgit-clone-tag-egit/.git
remote: Counting objects: 45422
remote: Finding sources: 100% (49920/49920)
Receiving objects:      100% (49920/49920)
Resolving deltas:       100% (21587/21587)
Updating references:    100% (56/56)
remote: Counting objects: 49920, done
remote: Total 49920 (delta 21587), reused 43550 (delta 21587)
From https://git.eclipse.org/r/egit/egit
 * [new branch]      master     -> origin/master
... skip bunch of refs
 * [new tag]         v3.0.0.201306101825-r -> v3.0.0.201306101825-r
... skip another bunch of refs
fatal: no such remote ref: 'v3.0.0.201306101825-r'

exit status: 128

> jgit version
jgit version 3.1.0.201310021548-r

[1] https://www.kernel.org/pub/software/scm/git/docs/git-clone.html