aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-10-26 23:45:37 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-10-26 23:45:37 +0200
commit0c3bc0c8b3eabe16e927475f26044ca9aaa50351 (patch)
tree219d36a5cd5b13af6c0231176ddca9b728a308b2 /remote.go
parentc66f495b35b12c6827507b9933b39a10fa94379b (diff)
downloadgo-git-0c3bc0c8b3eabe16e927475f26044ca9aaa50351.tar.gz
remote, fix copy tag reference on fetch
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go31
1 files changed, 28 insertions, 3 deletions
diff --git a/remote.go b/remote.go
index d94b2ad..7814255 100644
--- a/remote.go
+++ b/remote.go
@@ -190,8 +190,8 @@ func (r *Remote) updateObjectStorage(reader io.Reader) error {
}
func (r *Remote) updateLocalReferenceStorage(specs []config.RefSpec, refs []*core.Reference) error {
- for _, ref := range refs {
- for _, spec := range specs {
+ for _, spec := range specs {
+ for _, ref := range refs {
if !spec.Match(ref.Name()) {
continue
}
@@ -208,7 +208,32 @@ func (r *Remote) updateLocalReferenceStorage(specs []config.RefSpec, refs []*cor
}
}
- return nil
+ return r.buildFetchedTags()
+}
+
+func (r *Remote) buildFetchedTags() error {
+ iter, err := r.Refs()
+ if err != nil {
+ return err
+ }
+
+ os := r.s.ObjectStorage()
+ return iter.ForEach(func(ref *core.Reference) error {
+ if !ref.IsTag() {
+ return nil
+ }
+
+ _, err := os.Get(core.CommitObject, ref.Hash())
+ if err == core.ErrObjectNotFound {
+ return nil
+ }
+
+ if err != nil {
+ return err
+ }
+
+ return r.s.ReferenceStorage().Set(ref)
+ })
}
// Head returns the Reference of the HEAD