(refname string, author, committer *Signature, message string, tree *Tree)
| 189 | } |
| 190 | |
| 191 | func (c *Commit) Amend(refname string, author, committer *Signature, message string, tree *Tree) (*Oid, error) { |
| 192 | var cref *C.char |
| 193 | if refname == "" { |
| 194 | cref = nil |
| 195 | } else { |
| 196 | cref = C.CString(refname) |
| 197 | defer C.free(unsafe.Pointer(cref)) |
| 198 | } |
| 199 | |
| 200 | cmsg := C.CString(message) |
| 201 | defer C.free(unsafe.Pointer(cmsg)) |
| 202 | |
| 203 | runtime.LockOSThread() |
| 204 | defer runtime.UnlockOSThread() |
| 205 | |
| 206 | authorSig, err := author.toC() |
| 207 | if err != nil { |
| 208 | return nil, err |
| 209 | } |
| 210 | defer C.git_signature_free(authorSig) |
| 211 | |
| 212 | committerSig, err := committer.toC() |
| 213 | if err != nil { |
| 214 | return nil, err |
| 215 | } |
| 216 | defer C.git_signature_free(committerSig) |
| 217 | |
| 218 | oid := new(Oid) |
| 219 | |
| 220 | cerr := C.git_commit_amend(oid.toC(), c.cast_ptr, cref, authorSig, committerSig, nil, cmsg, tree.cast_ptr) |
| 221 | runtime.KeepAlive(oid) |
| 222 | runtime.KeepAlive(c) |
| 223 | runtime.KeepAlive(tree) |
| 224 | if cerr < 0 { |
| 225 | return nil, MakeGitError(cerr) |
| 226 | } |
| 227 | |
| 228 | return oid, nil |
| 229 | } |
nothing calls this directly
no test coverage detected