aboutsummaryrefslogtreecommitdiffstats
path: root/tag.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-10-27 02:42:36 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-10-27 02:42:36 +0200
commit0c6c4047155692caff733d0cd239b80508b7bd04 (patch)
tree522bc02e7c5e4f4f3968a7b38c74bc9773097d1f /tag.go
parent0c3bc0c8b3eabe16e927475f26044ca9aaa50351 (diff)
downloadgo-git-0c6c4047155692caff733d0cd239b80508b7bd04.tar.gz
remote, fix fetch tags
Diffstat (limited to 'tag.go')
-rw-r--r--tag.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/tag.go b/tag.go
index 4d039ab..0a8014b 100644
--- a/tag.go
+++ b/tag.go
@@ -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 ""
+}