@@ -1745,27 +1745,20 @@ static int odb_backend_write_cb(git_odb_backend *backend, const git_oid *oid, co
17451745{
17461746 ODBBackend * lua_backend = (ODBBackend * )backend ;
17471747 lua_State * L = lua_backend -> L ;
1748- int err ;
17491748
17501749 /* get Lua callback function. */
17511750 lua_rawgeti (L , LUA_REGISTRYINDEX , lua_backend -> write );
17521751
1752+ /* push oid */
1753+ obj_type_OID_push (L , * ((OID * )oid ));
17531754 /* push data onto stack. */
17541755 lua_pushlstring (L , data , len );
17551756 /* push otype */
17561757 lua_pushstring (L , git_object_type2string (type ));
17571758
17581759 /* call Lua function. */
1759- lua_call (L , 2 , 2 );
1760- // TODO: this is bork
1761- if (!lua_isnil (L , -2 )) {
1762- //*oid = obj_type_OID_check(L,-2);
1763- err = GIT_OK ;
1764- } else {
1765- err = lua_tointeger (L , -1 );
1766- }
1767-
1768- return err ;
1760+ lua_call (L , 3 , 1 );
1761+ return lua_tointeger (L , -1 );
17691762}
17701763
17711764static int odb_backend_exists_cb (git_odb_backend * backend , const git_oid * oid )
@@ -3183,7 +3176,7 @@ static int IndexEntry__delete__meth(lua_State *L) {
31833176 this_idx1 = obj_type_IndexEntry_delete (L ,1 ,& (this_flags_idx1 ));
31843177 if (!(this_flags_idx1 & OBJ_UDATA_FLAG_OWN )) { return 0 ; }
31853178 if (this_idx1 -> path != NULL ) {
3186- free (this_idx1 -> path );
3179+ free (( void * ) this_idx1 -> path );
31873180 }
31883181 free (this_idx1 );
31893182
@@ -3274,7 +3267,7 @@ static int IndexEntry__set_path__meth(lua_State *L) {
32743267 this_idx1 = obj_type_IndexEntry_check (L ,1 );
32753268 val_idx2 = luaL_checklstring (L ,2 ,& (val_len_idx2 ));
32763269 if (this_idx1 -> path != NULL ) {
3277- free (this_idx1 -> path );
3270+ free (( void * ) this_idx1 -> path );
32783271 }
32793272 char * path_buf = malloc (val_len_idx2 );
32803273 strncpy (path_buf , val_idx2 , val_len_idx2 );
@@ -3494,14 +3487,14 @@ static void dyn_caster_Object(void **obj, obj_type **type) {
34943487 case GIT_OBJ_BLOB :
34953488 * type = & (obj_type_Blob );
34963489 break ;
3497- case GIT_OBJ_COMMIT :
3498- * type = & (obj_type_Commit );
3490+ case GIT_OBJ_TREE :
3491+ * type = & (obj_type_Tree );
34993492 break ;
35003493 case GIT_OBJ_TAG :
35013494 * type = & (obj_type_Tag );
35023495 break ;
3503- case GIT_OBJ_TREE :
3504- * type = & (obj_type_Tree );
3496+ case GIT_OBJ_COMMIT :
3497+ * type = & (obj_type_Commit );
35053498 break ;
35063499 default :
35073500 break ;
@@ -3710,7 +3703,11 @@ static int Commit__create__func(lua_State *L) {
37103703 Commit * parent_idx9 ;
37113704 GitError err_idx1 = GIT_OK ;
37123705 int parent_count = 0 ;
3706+ #if LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR == 8
3707+ git_commit * * parents ;
3708+ #else
37133709 const git_commit * * parents ;
3710+ #endif
37143711 int n ;
37153712
37163713 oid_idx1 = obj_type_OID_check (L ,1 );
@@ -4717,11 +4714,11 @@ static const obj_field obj_IndexEntry_fields[] = {
47174714};
47184715
47194716static const obj_const obj_IndexEntry_constants [] = {
4720- {"STAGEMASK" , NULL , 12288 , CONST_NUMBER },
4721- {"STAGESHIFT" , NULL , 12 , CONST_NUMBER },
4722- {"NAMEMASK" , NULL , 4095 , CONST_NUMBER },
47234717 {"EXTENDED" , NULL , 16384 , CONST_NUMBER },
4718+ {"NAMEMASK" , NULL , 4095 , CONST_NUMBER },
4719+ {"STAGEMASK" , NULL , 12288 , CONST_NUMBER },
47244720 {"VALID" , NULL , 32768 , CONST_NUMBER },
4721+ {"STAGESHIFT" , NULL , 12 , CONST_NUMBER },
47254722 {NULL , NULL , 0.0 , 0 }
47264723};
47274724
@@ -4807,10 +4804,10 @@ static const luaL_Reg obj_Blob_pub_funcs[] = {
48074804};
48084805
48094806static const luaL_Reg obj_Blob_methods [] = {
4810- {"id" , Object__id__meth },
48114807 {"owner" , Object__owner__meth },
4812- {"free " , Object__free__meth },
4808+ {"id " , Object__id__meth },
48134809 {"type" , Object__type__meth },
4810+ {"free" , Object__free__meth },
48144811 {"rawcontent" , Blob__rawcontent__meth },
48154812 {"rawsize" , Blob__rawsize__meth },
48164813 {NULL , NULL }
@@ -4884,8 +4881,8 @@ static const luaL_Reg obj_Commit_pub_funcs[] = {
48844881
48854882static const luaL_Reg obj_Commit_methods [] = {
48864883 {"owner" , Object__owner__meth },
4887- {"free" , Object__free__meth },
48884884 {"type" , Object__type__meth },
4885+ {"free" , Object__free__meth },
48894886 {"id" , Commit__id__meth },
48904887 {"message_encoding" , Commit__message_encoding__meth },
48914888 {"message" , Commit__message__meth },
@@ -4929,10 +4926,10 @@ static const luaL_Reg obj_Tree_pub_funcs[] = {
49294926};
49304927
49314928static const luaL_Reg obj_Tree_methods [] = {
4932- {"id" , Object__id__meth },
49334929 {"owner" , Object__owner__meth },
4934- {"free " , Object__free__meth },
4930+ {"id " , Object__id__meth },
49354931 {"type" , Object__type__meth },
4932+ {"free" , Object__free__meth },
49364933 {"entrycount" , Tree__entrycount__meth },
49374934 {"entry_byname" , Tree__entry_byname__meth },
49384935 {"entry_byindex" , Tree__entry_byindex__meth },
@@ -5003,10 +5000,10 @@ static const luaL_Reg obj_Tag_pub_funcs[] = {
50035000};
50045001
50055002static const luaL_Reg obj_Tag_methods [] = {
5006- {"id" , Object__id__meth },
50075003 {"owner" , Object__owner__meth },
5008- {"free " , Object__free__meth },
5004+ {"id " , Object__id__meth },
50095005 {"type" , Object__type__meth },
5006+ {"free" , Object__free__meth },
50105007 {"target" , Tag__target__meth },
50115008 {"name" , Tag__name__meth },
50125009 {"tagger" , Tag__tagger__meth },
@@ -5070,10 +5067,10 @@ static const obj_field obj_RevWalk_fields[] = {
50705067};
50715068
50725069static const obj_const obj_RevWalk_constants [] = {
5070+ {"SORT_NONE" , NULL , 0 , CONST_NUMBER },
5071+ {"SORT_TOPOLOGICAL" , NULL , 1 , CONST_NUMBER },
50735072 {"SORT_TIME" , NULL , 2 , CONST_NUMBER },
50745073 {"SORT_REVERSE" , NULL , 4 , CONST_NUMBER },
5075- {"SORT_TOPOLOGICAL" , NULL , 1 , CONST_NUMBER },
5076- {"SORT_NONE" , NULL , 0 , CONST_NUMBER },
50775074 {NULL , NULL , 0.0 , 0 }
50785075};
50795076
@@ -5127,35 +5124,35 @@ static const luaL_Reg git2_function[] = {
51275124};
51285125
51295126static const obj_const git2_constants [] = {
5130- #ifdef GIT_REVWALKOVER
5131- {"REVWALKOVER" , NULL , GIT_REVWALKOVER , CONST_NUMBER },
5132- #endif
5127+ {"REF_OID" , NULL , 1 , CONST_NUMBER },
51335128#ifdef GIT_OK
51345129 {"OK" , NULL , GIT_OK , CONST_NUMBER },
51355130#endif
5136- {"REF_INVALID" , NULL , 0 , CONST_NUMBER },
5137- {"REF_OID" , NULL , 1 , CONST_NUMBER },
5138- #ifdef GIT_PASSTHROUGH
5139- {"PASSTHROUGH" , NULL , GIT_PASSTHROUGH , CONST_NUMBER },
5131+ #ifdef GIT_EEXISTS
5132+ {"EEXISTS" , NULL , GIT_EEXISTS , CONST_NUMBER },
51405133#endif
5134+ {"REF_PACKED" , NULL , 4 , CONST_NUMBER },
51415135 {"REF_SYMBOLIC" , NULL , 2 , CONST_NUMBER },
51425136 {"REF_HAS_PEEL" , NULL , 8 , CONST_NUMBER },
5137+ #ifdef GIT_ERROR
5138+ {"ERROR" , NULL , GIT_ERROR , CONST_NUMBER },
5139+ #endif
5140+ #ifdef GIT_ENOTFOUND
5141+ {"ENOTFOUND" , NULL , GIT_ENOTFOUND , CONST_NUMBER },
5142+ #endif
51435143#ifdef GIT_EBUFS
51445144 {"EBUFS" , NULL , GIT_EBUFS , CONST_NUMBER },
51455145#endif
5146- {"REF_PACKED" , NULL , 4 , CONST_NUMBER },
5147- {"REF_LISTALL" , NULL , 7 , CONST_NUMBER },
5148- #ifdef GIT_EEXISTS
5149- {"EEXISTS" , NULL , GIT_EEXISTS , CONST_NUMBER },
5146+ {"REF_INVALID" , NULL , 0 , CONST_NUMBER },
5147+ #ifdef GIT_REVWALKOVER
5148+ {"REVWALKOVER" , NULL , GIT_REVWALKOVER , CONST_NUMBER },
51505149#endif
51515150#ifdef GIT_EAMBIGUOUS
51525151 {"EAMBIGUOUS" , NULL , GIT_EAMBIGUOUS , CONST_NUMBER },
51535152#endif
5154- #ifdef GIT_ENOTFOUND
5155- {"ENOTFOUND" , NULL , GIT_ENOTFOUND , CONST_NUMBER },
5156- #endif
5157- #ifdef GIT_ERROR
5158- {"ERROR" , NULL , GIT_ERROR , CONST_NUMBER },
5153+ {"REF_LISTALL" , NULL , 7 , CONST_NUMBER },
5154+ #ifdef GIT_PASSTHROUGH
5155+ {"PASSTHROUGH" , NULL , GIT_PASSTHROUGH , CONST_NUMBER },
51595156#endif
51605157 {NULL , NULL , 0.0 , 0 }
51615158};
0 commit comments