diff options
| author | Vicent Marti <[email protected]> | 2013-03-06 16:59:45 +0100 |
|---|---|---|
| committer | Vicent Marti <[email protected]> | 2013-03-06 16:59:45 +0100 |
| commit | 20e2528478b0154aa63606645e67f7260ff3c2b3 (patch) | |
| tree | 879cf8c83f2122f76dd26bbe135e1185938b52a3 /commit.go | |
| parent | bdfd8736bc8c119c4a841fd8b1c8202f5d5ceb9a (diff) | |
Repository.CreateCommit
Diffstat (limited to 'commit.go')
| -rw-r--r-- | commit.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -10,6 +10,7 @@ import "C" import ( "runtime" + "unsafe" "time" ) @@ -74,3 +75,20 @@ func (sig *Signature) Time() time.Time { loc := time.FixedZone("", sig.Offset*60) return time.Unix(sig.UnixTime, 0).In(loc) } + +func (sig *Signature) toC() (*C.git_signature) { + var out *C.git_signature + + name := C.CString(sig.Name) + defer C.free(unsafe.Pointer(name)) + + email := C.CString(sig.Email) + defer C.free(unsafe.Pointer(email)) + + ret := C.git_signature_new(&out, name, email, C.git_time_t(sig.UnixTime), C.int(sig.Offset)) + if ret < 0 { + return nil + } + + return out +} |
