diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-06-08 04:11:21 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-06-08 04:11:21 +0200 |
| commit | 36e0a256fe79f87447bb730fda53e5cbc90eb47c (patch) | |
| tree | 202ffb84de0f87dd072194b554e18dfd56af0fc4 /index.go | |
| parent | 85fde1fcfbc3fd6000b8fa1a4041b4c314a92b2f (diff) | |
Update to libgit2 b6011e29
Diffstat (limited to 'index.go')
| -rw-r--r-- | index.go | 42 |
1 files changed, 23 insertions, 19 deletions
@@ -12,7 +12,6 @@ import "C" import ( "fmt" "runtime" - "time" "unsafe" ) @@ -31,13 +30,18 @@ type Index struct { ptr *C.git_index } +type IndexTime struct { + seconds int32 + nanoseconds uint32 +} + type IndexEntry struct { - Ctime time.Time - Mtime time.Time + Ctime IndexTime + Mtime IndexTime Mode Filemode - Uid uint - Gid uint - Size uint + Uid uint32 + Gid uint32 + Size uint32 Id *Oid Path string } @@ -47,26 +51,26 @@ func newIndexEntryFromC(entry *C.git_index_entry) *IndexEntry { return nil } return &IndexEntry{ - time.Unix(int64(entry.ctime.seconds), int64(entry.ctime.nanoseconds)), - time.Unix(int64(entry.mtime.seconds), int64(entry.mtime.nanoseconds)), + IndexTime { int32(entry.ctime.seconds), uint32(entry.ctime.nanoseconds) }, + IndexTime { int32(entry.mtime.seconds), uint32(entry.mtime.nanoseconds) }, Filemode(entry.mode), - uint(entry.uid), - uint(entry.gid), - uint(entry.file_size), + uint32(entry.uid), + uint32(entry.gid), + uint32(entry.file_size), newOidFromC(&entry.id), C.GoString(entry.path), } } func populateCIndexEntry(source *IndexEntry, dest *C.git_index_entry) { - dest.ctime.seconds = C.git_time_t(source.Ctime.Unix()) - dest.ctime.nanoseconds = C.uint(source.Ctime.UnixNano()) - dest.mtime.seconds = C.git_time_t(source.Mtime.Unix()) - dest.mtime.nanoseconds = C.uint(source.Mtime.UnixNano()) - dest.mode = C.uint(source.Mode) - dest.uid = C.uint(source.Uid) - dest.gid = C.uint(source.Gid) - dest.file_size = C.git_off_t(source.Size) + dest.ctime.seconds = C.int32_t(source.Ctime.seconds) + dest.ctime.nanoseconds = C.uint32_t(source.Ctime.nanoseconds) + dest.mtime.seconds = C.int32_t(source.Mtime.seconds) + dest.mtime.nanoseconds = C.uint32_t(source.Mtime.nanoseconds) + dest.mode = C.uint32_t(source.Mode) + dest.uid = C.uint32_t(source.Uid) + dest.gid = C.uint32_t(source.Gid) + dest.file_size = C.uint32_t(source.Size) dest.id = *source.Id.toC() dest.path = C.CString(source.Path) } |
