From 06719bcfd61dea7cde6155b0eaa4b05466b6b07c Mon Sep 17 00:00:00 2001 From: Ervin Oro Date: Sun, 1 Oct 2017 15:37:16 +0300 Subject: [PATCH 1/2] Add func (c Commit) Time() time.Time --- commit.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/commit.go b/commit.go index 07b7c37..d419af2 100644 --- a/commit.go +++ b/commit.go @@ -9,6 +9,7 @@ import "C" import ( "runtime" + "time" "unsafe" ) @@ -18,6 +19,10 @@ type Commit struct { 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 { return C.GoString(C.git_commit_message(c.cast_ptr)) } -- 2.45.2 From 44c1f328adb16aaa949bb58a6966db679ad7931c Mon Sep 17 00:00:00 2001 From: Ervin Oro Date: Wed, 29 Nov 2017 17:36:13 +0200 Subject: [PATCH 2/2] Make unknown changes --- graph.go | 2 +- odb.go | 2 +- settings_test.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/graph.go b/graph.go index e5d7732..bc2319c 100644 --- a/graph.go +++ b/graph.go @@ -17,7 +17,7 @@ func (repo *Repository) DescendantOf(commit, ancestor *Oid) (bool, error) { return false, MakeGitError(ret) } - return (ret > 0), nil + return ret > 0, nil } func (repo *Repository) AheadBehind(local, upstream *Oid) (ahead, behind int, err error) { diff --git a/odb.go b/odb.go index a728cd3..63c2618 100644 --- a/odb.go +++ b/odb.go @@ -236,7 +236,7 @@ func (object *OdbObject) Data() (data []byte) { len := int(C.git_odb_object_size(object.ptr)) - sliceHeader := (*reflect.SliceHeader)((unsafe.Pointer(&blob))) + sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&blob)) sliceHeader.Cap = len sliceHeader.Len = len sliceHeader.Data = uintptr(c_blob) diff --git a/settings_test.go b/settings_test.go index 3a4ce0a..595d076 100644 --- a/settings_test.go +++ b/settings_test.go @@ -11,9 +11,9 @@ type pathPair struct { func TestSearchPath(t *testing.T) { paths := []pathPair{ - pathPair{ConfigLevelSystem, "/tmp/system"}, - pathPair{ConfigLevelGlobal, "/tmp/global"}, - pathPair{ConfigLevelXDG, "/tmp/xdg"}, + {ConfigLevelSystem, "/tmp/system"}, + {ConfigLevelGlobal, "/tmp/global"}, + {ConfigLevelXDG, "/tmp/xdg"}, } for _, pair := range paths { -- 2.45.2