@@ -67,8 +67,7 @@ type TagsCollection struct {
67
67
repo * Repository
68
68
}
69
69
70
- func (c * TagsCollection ) Create (
71
- name string , commit * Commit , tagger * Signature , message string ) (* Oid , error ) {
70
+ func (c * TagsCollection ) Create (name string , obj Objecter , tagger * Signature , message string ) (* Oid , error ) {
72
71
73
72
oid := new (Oid )
74
73
@@ -84,13 +83,13 @@ func (c *TagsCollection) Create(
84
83
}
85
84
defer C .git_signature_free (taggerSig )
86
85
87
- ctarget := commit .ptr
88
-
89
86
runtime .LockOSThread ()
90
87
defer runtime .UnlockOSThread ()
91
88
92
- ret := C .git_tag_create (oid .toC (), c .repo .ptr , cname , ctarget , taggerSig , cmessage , 0 )
89
+ o := obj .AsObject ()
90
+ ret := C .git_tag_create (oid .toC (), c .repo .ptr , cname , o .ptr , taggerSig , cmessage , 0 )
93
91
runtime .KeepAlive (c )
92
+ runtime .KeepAlive (obj )
94
93
if ret < 0 {
95
94
return nil , MakeGitError (ret )
96
95
}
@@ -114,7 +113,7 @@ func (c *TagsCollection) Remove(name string) error {
114
113
return nil
115
114
}
116
115
117
- // CreateLightweight creates a new lightweight tag pointing to a commit
116
+ // CreateLightweight creates a new lightweight tag pointing to an object
118
117
// and returns the id of the target object.
119
118
//
120
119
// The name of the tag is validated for consistency (see git_tag_create() for the rules
@@ -126,20 +125,20 @@ func (c *TagsCollection) Remove(name string) error {
126
125
// The created tag is a simple reference and can be queried using
127
126
// repo.References.Lookup("refs/tags/<name>"). The name of the tag (eg "v1.0.0")
128
127
// is queried with ref.Shorthand().
129
- func (c * TagsCollection ) CreateLightweight (name string , commit * Commit , force bool ) (* Oid , error ) {
128
+ func (c * TagsCollection ) CreateLightweight (name string , obj Objecter , force bool ) (* Oid , error ) {
130
129
131
130
oid := new (Oid )
132
131
133
132
cname := C .CString (name )
134
133
defer C .free (unsafe .Pointer (cname ))
135
134
136
- ctarget := commit .ptr
137
-
138
135
runtime .LockOSThread ()
139
136
defer runtime .UnlockOSThread ()
140
137
141
- err := C .git_tag_create_lightweight (oid .toC (), c .repo .ptr , cname , ctarget , cbool (force ))
138
+ o := obj .AsObject ()
139
+ err := C .git_tag_create_lightweight (oid .toC (), c .repo .ptr , cname , o .ptr , cbool (force ))
142
140
runtime .KeepAlive (c )
141
+ runtime .KeepAlive (obj )
143
142
if err < 0 {
144
143
return nil , MakeGitError (err )
145
144
}
0 commit comments