Example #1
0
	must_pass(git_repository_open(&repo, "../d/e.git"));

	git_repository_free(repo);

	must_pass(chdir(current_workdir));
	rmdir_recurs(TEMP_REPO_FOLDER);
END_TEST

#define EMPTY_BARE_REPOSITORY_NAME		"empty_bare.git"
#define EMPTY_BARE_REPOSITORY_FOLDER	TEST_RESOURCES "/" EMPTY_BARE_REPOSITORY_NAME "/"

BEGIN_TEST(open0, "Open a bare repository that has just been initialized by git")
	git_repository *repo;

	must_pass(copydir_recurs(EMPTY_BARE_REPOSITORY_FOLDER, TEMP_REPO_FOLDER));
	must_pass(remove_placeholders(TEMP_REPO_FOLDER, "dummy-marker.txt"));

	must_pass(git_repository_open(&repo, TEMP_REPO_FOLDER));
	must_be_true(git_repository_path(repo) != NULL);
	must_be_true(git_repository_workdir(repo) == NULL);

	git_repository_free(repo);
	must_pass(rmdir_recurs(TEMP_REPO_FOLDER));
END_TEST

#define SOURCE_EMPTY_REPOSITORY_NAME	"empty_standard_repo/.gitted"
#define EMPTY_REPOSITORY_NAME			"empty_standard_repo/.git"
#define EMPTY_REPOSITORY_FOLDER			TEST_RESOURCES "/" SOURCE_EMPTY_REPOSITORY_NAME "/"
#define DEST_REPOSITORY_FOLDER			TEMP_REPO_FOLDER DOT_GIT "/"

BEGIN_TEST(open1, "Open a standard repository that has just been initialized by git")
Example #2
0
	int *count = (int *)payload;;

	GIT_UNUSED_ARG(path);
	GIT_UNUSED_ARG(status_flags);

	(void) *count++;

	return GIT_SUCCESS;
}

BEGIN_TEST(statuscb1, "test retrieving status for a worktree of an empty repository")
	git_repository *repo;
	int count = 0;

	must_pass(copydir_recurs(EMPTY_REPOSITORY_FOLDER, TEST_STD_REPO_FOLDER));
	must_pass(remove_placeholders(TEST_STD_REPO_FOLDER, "dummy-marker.txt"));
	must_pass(git_repository_open(&repo, TEST_STD_REPO_FOLDER));

	must_pass(git_status_foreach(repo, status_cb1, &count));
	must_be_true(count == 0);

	git_repository_free(repo);

	git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
END_TEST

static const char *entry_paths2[] = {
	"current_file",
	"file_deleted",
	"ignored_file",
	"modified_file",