Git2go fetch deleted tags

I'm trying to fetch tags from remote using git2go ( https://github.com/libgit2/git2go ). When I clone the repository, I can list all the tags with the following code:

iter, err := repository.NewReferenceIterator()

ref, err := iter.Next()
for err == nil {
    if ref.IsTag() {
        fmt.Println(ref.Name())
    }

    ref, err = iter.Next()
}

      

But when I fetch the code from the remote it doesn't update the tags. I'm fetching new code from the repository with:

remote, err := p.repository.LoadRemote("origin")
remote.Fetch([]string{}, nil, "")

      

This is my config:

[core]
    bare = false
    repositoryformatversion = 0
    filemode = true
    logallrefupdates = true
[remote "origin"]
    url = file:///home/testrepo

    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

      

I added ( Can I specify in .git / config to fetch multiple refspecs? ):

fetch = refs/tags/*:refs/tags/*

      

But that doesn't do anything.

I also added tags to the refspec, but that gave an error: ref 'refs / remotes / origin / master' does not match destination

+3


source to share


1 answer


The Remote.Fetch () doc mentions:

use empty list to use refspecs from config.

default refspec does not import tags .
(Even with regular git, you'll need itgit fetch --tags

).
Default:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*

      

You can:




gyre reports in the comments since this code works to the point:

to the point where I need the PEEL tag: Peel is where git2go

it somehow returns errors that it can't clear with a link in the tag.

+2


source







All Articles