diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-10-27 02:42:36 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-10-27 02:42:36 +0200 |
commit | 0c6c4047155692caff733d0cd239b80508b7bd04 (patch) | |
tree | 522bc02e7c5e4f4f3968a7b38c74bc9773097d1f /tag.go | |
parent | 0c3bc0c8b3eabe16e927475f26044ca9aaa50351 (diff) | |
download | go-git-0c6c4047155692caff733d0cd239b80508b7bd04.tar.gz |
remote, fix fetch tags
Diffstat (limited to 'tag.go')
-rw-r--r-- | tag.go | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -28,13 +28,6 @@ type Tag struct { r *Repository } -// Type returns the type of object. It always returns core.TreeObject. -/* -func (t *Tag) Type() core.ObjectType { - return core.TagObject -} -*/ - // ID returns the object ID of the tag, not the object that the tag references. // The returned value will always match the current value of Tag.Hash. // @@ -180,10 +173,11 @@ func (t *Tag) Object() (Object, error) { // string. func (t *Tag) String() string { obj, _ := t.Object() + return fmt.Sprintf( "%s %s\nTagger: %s\nDate: %s\n\n%s\n%s", core.TagObject, t.Name, t.Tagger.String(), t.Tagger.When.Format(DateFormat), - t.Message, obj, + t.Message, objectAsString(obj), ) } @@ -226,3 +220,14 @@ func (iter *TagIter) ForEach(cb func(*Tag) error) error { return cb(tag) }) } + +func objectAsString(obj Object) string { + switch o := obj.(type) { + case *Commit: + return o.String() + case *Tag: + return o.String() + } + + return "" +} |