@@ -5,7 +5,17 @@ ffi.cdef [[
55 typedef struct git_commit git_commit;
66 typedef struct git_object git_object;
77 typedef struct git_reference git_reference;
8- typedef struct git_signature git_signature;
8+
9+ typedef struct {
10+ char * name ;
11+ char * email ;
12+ struct {
13+ int64_t time ;
14+ int offset ;
15+ char sign ;
16+ } when ;
17+ } git_signature;
18+
919 typedef struct git_index git_index;
1020 typedef struct git_remote git_remote;
1121
@@ -75,7 +85,7 @@ lib.git_libgit2_init()
7585--- @class git2.ffi.Signature : ffi.cdata*
7686--- @field name string
7787--- @field email string
78- --- @field when_time integer
88+ --- @field when { time : integer , offset : integer , sign : string }
7989
8090-- value types
8191
@@ -95,7 +105,6 @@ lib.git_libgit2_init()
95105
96106-- helpers
97107
98- local sigLayout = ffi .typeof (" struct { char *name; char *email; int64_t when_time; int when_offset; } *" )
99108
100109--- @param code integer
101110local function check (code )
116125--- @param sig git2.ffi.Signature
117126--- @return git2.Sig
118127local function wrapSig (sig )
119- local s = ffi .cast (sigLayout , sig )
120- return { name = ffi .string (s .name ), email = ffi .string (s .email ), time = tonumber (s .when_time ) }
128+ return { name = ffi .string (sig .name ), email = ffi .string (sig .email ), time = tonumber (sig .when .time ) }
121129end
122130
123131--- @param c git2.ffi.Commit
0 commit comments