Exemple #1
0
void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
{
	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;

	set_repo_symlink_handling_cap_to(true);

	opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;

	cl_git_pass(git_checkout_index(g_repo, NULL, &opts));

#ifdef GIT_WIN32
	test_file_contents("./testrepo/link_to_new.txt", "new.txt");
#else
	{
		char link_data[1024];
		size_t link_size = 1024;

		link_size = p_readlink("./testrepo/link_to_new.txt", link_data, link_size);
		link_data[link_size] = '\0';
		cl_assert_equal_i(link_size, strlen("new.txt"));
		cl_assert_equal_s(link_data, "new.txt");
		test_file_contents("./testrepo/link_to_new.txt", "my new file\n");
	}
#endif
}
Exemple #2
0
void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
{
	set_repo_symlink_handling_cap_to(false);

	cl_git_pass(git_checkout_index(g_repo, &g_opts));

	test_file_contents("./testrepo/link_to_new.txt", "new.txt");
}
Exemple #3
0
void test_checkout_index__honor_coresymlinks_setting_set_to_false(void)
{
	git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;

	set_repo_symlink_handling_cap_to(false);

	opts.checkout_strategy = GIT_CHECKOUT_SAFE_CREATE;

	cl_git_pass(git_checkout_index(g_repo, NULL, &opts));

	test_file_contents("./testrepo/link_to_new.txt", "new.txt");
}
void test_checkout_index__honor_coresymlinks_setting_set_to_true(void)
{
	set_repo_symlink_handling_cap_to(true);

	cl_git_pass(git_checkout_index(g_repo, &g_opts, NULL));

#ifdef GIT_WIN32
	test_file_contents("./testrepo/link_to_new.txt", "new.txt");
#else
	{
		char link_data[1024];
		size_t link_size = 1024;

		link_size = p_readlink("./testrepo/link_to_new.txt", link_data, link_size);
		link_data[link_size] = '\0';
		cl_assert_equal_i(link_size, strlen("new.txt"));
		cl_assert_equal_s(link_data, "new.txt");
		test_file_contents("./testrepo/link_to_new.txt", "my new file\n");
	}
#endif
}