Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Cannot clone with a reference to a tag #960

Closed
@fkorotkov

Description

@fkorotkov

I'm using the following snippet to clone a single tag:

func main() {
	cloneDirPtr := flag.String("clone-dir", os.Args[0], "Directory to clone")
	cloneUrlPtr := flag.String("clone-url", "https://github.com/fkorotkov/k8s-kotlin-dsl.git", "URL to clone")
	flag.Parse()

	cloneOptions := git.CloneOptions{
		URL:           *cloneUrlPtr,
		ReferenceName: plumbing.ReferenceName("refs/tags/0.9"),
		SingleBranch:  true,
		Progress:      os.Stdout,
		Tags:          git.NoTags,
	}
	_, err := git.PlainClone(*cloneDirPtr, false, &cloneOptions)
	CheckIfError(err)
}

After cloning to temp directory I did the following:

fedor-mbp master$: cd temp/
fedor-mbp HEAD$: git branch -a
* (no branch)

If I change ref from refs/tags/0.9 to refs/heads/master and do the same I see:

fedor-mbp master$: cd temp/
fedor-mbp master$: git branch -a
* master
  remotes/origin/master

Git correctly sees that master branch is checked out. I'd expect the same behaviour for tag refs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions