Add func (c Commit) Time() time.Time #410

Closed
ervinoro wants to merge 2 commits from v25 into v25
1 changed files with 5 additions and 0 deletions
Showing only changes of commit 06719bcfd6 - Show all commits

View File

@ -9,6 +9,7 @@ import "C"
import ( import (
"runtime" "runtime"
"time"
"unsafe" "unsafe"
) )
@ -18,6 +19,10 @@ type Commit struct {
cast_ptr *C.git_commit cast_ptr *C.git_commit
} }
func (c Commit) Time() time.Time {
return time.Unix(int64(C.git_commit_time(c.cast_ptr)), 0)
}
func (c Commit) Message() string { func (c Commit) Message() string {
return C.GoString(C.git_commit_message(c.cast_ptr)) return C.GoString(C.git_commit_message(c.cast_ptr))
} }