summaryrefslogtreecommitdiff
path: root/commit.go
diff options
context:
space:
mode:
authorVicent Marti <[email protected]>2013-03-06 16:59:45 +0100
committerVicent Marti <[email protected]>2013-03-06 16:59:45 +0100
commit20e2528478b0154aa63606645e67f7260ff3c2b3 (patch)
tree879cf8c83f2122f76dd26bbe135e1185938b52a3 /commit.go
parentbdfd8736bc8c119c4a841fd8b1c8202f5d5ceb9a (diff)
Repository.CreateCommit
Diffstat (limited to 'commit.go')
-rw-r--r--commit.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/commit.go b/commit.go
index 779ebd7..93160ba 100644
--- a/commit.go
+++ b/commit.go
@@ -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
+}