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

Fetch remote tags to local #371

Closed
manuwell opened this issue Apr 28, 2017 · 3 comments · Fixed by #485
Closed

Fetch remote tags to local #371

manuwell opened this issue Apr 28, 2017 · 3 comments · Fixed by #485
Labels

Comments

@manuwell
Copy link

Hey guys,

I'm trying to fetch remote tags but it seems that tags are ignored when fetching or pulling from remote. Trying to perform the following operations:

         r.Fetch(&git.FetchOptions{
                 RemoteName: "origin",
         })

         refs, err := r.References()
         CheckIfError(err)

         err = refs.ForEach(func(ref *plumbing.Reference) error {
                 fmt.Println(ref)
                 return nil
         })

outputs

3dbebd24ff81327fd7171ccfa4d4ed81a6070069 refs/remotes/origin/master
3dbebd24ff81327fd7171ccfa4d4ed81a6070069 refs/heads/master
ref: refs/remotes/origin/master refs/remotes/origin/HEAD
ref: refs/heads/master HEAD

But no tags were fetched. What I'm trying to perform is a git pull --tags git operation. Is it already supported on go-git?

Thanks and congrats for this project.

@smola
Copy link
Collaborator

smola commented May 4, 2017

I think we're doing the equivalent of git fetch --no-tags and you can fetch tags explicitely by adding the refspec +refs/tags/*:refs/tags/* to your fetch. We could look into being able to replicate the default git behavior though.

@manuwell
Copy link
Author

manuwell commented May 5, 2017

I tried passing the suggested refspec but seems that object already exists.

Debugging here I found this piece of code returning true to a fetched tag because, I think, it is looking for the commit hash instead the tag name to check the presence.

The storer used on my local tests is filesystem. I couldn't go further in this problem.

@smola smola added the bug label May 5, 2017
@smola
Copy link
Collaborator

smola commented May 5, 2017

@manuwell Ok, this does look like a bug, we'll look into it. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants