Exemplo n.º 1
0
static int handle_linear_syntax(git_object **out, git_object *obj, int n)
{
	git_object *temp_commit = NULL;
	int error;

	if (git_object_peel(&temp_commit, obj, GIT_OBJ_COMMIT) < 0)
		return -1;

	error = git_commit_nth_gen_ancestor((git_commit **)out, (git_commit*)temp_commit, n);

	git_object_free(temp_commit);
	return error;
}
Exemplo n.º 2
0
static int handle_linear_syntax(git_object **out, git_object *obj, int n)
{
	git_object *temp_commit = NULL;
	int error;

	if ((error = git_object_peel(&temp_commit, obj, GIT_OBJ_COMMIT)) < 0)
		return (error == GIT_EAMBIGUOUS || error == GIT_ENOTFOUND) ?
			GIT_EINVALIDSPEC : error;

	error = git_commit_nth_gen_ancestor((git_commit **)out, (git_commit*)temp_commit, n);

	git_object_free(temp_commit);
	return error;
}
Exemplo n.º 3
0
static void assert_nth_gen_parent(unsigned int gen, const char *expected_oid)
{
	git_commit *parent = NULL;
	int error;
	
	error = git_commit_nth_gen_ancestor(&parent, commit, gen);

	if (expected_oid != NULL) {
		cl_assert_equal_i(0, error);
		cl_assert_equal_i(0, git_oid_streq(git_commit_id(parent), expected_oid));
	} else
		cl_assert_equal_i(GIT_ENOTFOUND, error);

	git_commit_free(parent);
}
Exemplo n.º 4
0
Arquivo: commit.c Projeto: jwes/luagi
int luagi_commit_nth_gen_ancestor( lua_State *L )
{
   git_commit** commit = checkcommit( L );
   unsigned int n = luaL_checkinteger( L, 2 );
   //lua to c 
   n--;
   
   git_commit** anc = (git_commit**) lua_newuserdata( L, sizeof( git_commit* ) );

   int ret = git_commit_nth_gen_ancestor( anc, *commit, n );
   if( ret != 0 )
   {
      return ltk_push_git_error( L );
   }
   ltk_setmetatable( L, LUAGI_COMMIT_FUNCS );
   return 1;
}