Exemplo n.º 1
0
void test_network_remoterename__renaming_a_remote_moves_related_configuration_section(void)
{
	assert_config_entry_existence(_repo, "remote.test.fetch", true);
	assert_config_entry_existence(_repo, "remote.just/renamed.fetch", false);

	cl_git_pass(git_remote_rename(_remote, "just/renamed", dont_call_me_cb, NULL));

	assert_config_entry_existence(_repo, "remote.test.fetch", false);
	assert_config_entry_existence(_repo, "remote.just/renamed.fetch", true);
}
Exemplo n.º 2
0
void test_refs_branches_delete__deleting_a_branch_removes_related_configuration_data(void)
{
	git_reference *branch;

	assert_config_entry_existence(repo, "branch.track-local.remote", true);
	assert_config_entry_existence(repo, "branch.track-local.merge", true);

	cl_git_pass(git_branch_lookup(&branch, repo, "track-local", GIT_BRANCH_LOCAL));
	cl_git_pass(git_branch_delete(branch));
	git_reference_free(branch);

	assert_config_entry_existence(repo, "branch.track-local.remote", false);
	assert_config_entry_existence(repo, "branch.track-local.merge", false);
}
Exemplo n.º 3
0
void test_network_remote_rename__renaming_a_remote_moves_related_configuration_section(void)
{
	git_strarray problems = {0};

	assert_config_entry_existence(_repo, "remote.test.fetch", true);
	assert_config_entry_existence(_repo, "remote.just/renamed.fetch", false);

	cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "just/renamed"));
	cl_assert_equal_i(0, problems.count);
	git_strarray_free(&problems);

	assert_config_entry_existence(_repo, "remote.test.fetch", false);
	assert_config_entry_existence(_repo, "remote.just/renamed.fetch", true);
}
Exemplo n.º 4
0
void test_network_remoterename__renaming_a_remote_without_a_fetchrefspec_doesnt_create_one(void)
{
	git_config *config;

	git_remote_free(_remote);
	cl_git_pass(git_repository_config__weakptr(&config, _repo));
	cl_git_pass(git_config_delete(config, "remote.test.fetch"));

	cl_git_pass(git_remote_load(&_remote, _repo, "test"));

	assert_config_entry_existence(_repo, "remote.test.fetch", false);

	cl_git_pass(git_remote_rename(_remote, "just/renamed", dont_call_me_cb, NULL));

	assert_config_entry_existence(_repo, "remote.just/renamed.fetch", false);
}
Exemplo n.º 5
0
void test_network_remoterename__renaming_an_inmemory_remote_persists_it(void)
{
	git_remote *remote;

	assert_config_entry_existence(_repo, "remote.durable.url", false);

	cl_git_pass(git_remote_new(&remote, _repo, NULL, "git://github.com/libgit2/durable.git", NULL));

	assert_config_entry_existence(_repo, "remote.durable.url", false);

	cl_git_pass(git_remote_rename(remote, "durable", dont_call_me_cb, NULL));

	assert_config_entry_value(_repo, "remote.durable.url", "git://github.com/libgit2/durable.git");

	git_remote_free(remote);
}
Exemplo n.º 6
0
void test_network_remote_rename__new_name_can_contain_dots(void)
{
	git_strarray problems = {0};

	cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "just.renamed"));
	cl_assert_equal_i(0, problems.count);
	git_strarray_free(&problems);
	assert_config_entry_existence(_repo, "remote.just.renamed.fetch", true);
}
Exemplo n.º 7
0
void test_network_remote_rename__renaming_a_remote_without_a_fetchrefspec_doesnt_create_one(void)
{
	git_config *config;
	git_remote *remote;
	git_strarray problems = {0};

	cl_git_pass(git_repository_config__weakptr(&config, _repo));
	cl_git_pass(git_config_delete_entry(config, "remote.test.fetch"));

	cl_git_pass(git_remote_lookup(&remote, _repo, "test"));
	git_remote_free(remote);

	assert_config_entry_existence(_repo, "remote.test.fetch", false);

	cl_git_pass(git_remote_rename(&problems, _repo, _remote_name, "just/renamed"));
	cl_assert_equal_i(0, problems.count);
	git_strarray_free(&problems);

	assert_config_entry_existence(_repo, "remote.just/renamed.fetch", false);
}
Exemplo n.º 8
0
void test_network_remote_remotes__tagopt(void)
{
	const char *name = git_remote_name(_remote);

	git_remote_set_autotag(_repo, name, GIT_REMOTE_DOWNLOAD_TAGS_ALL);
	assert_config_entry_value(_repo, "remote.test.tagopt", "--tags");

	git_remote_set_autotag(_repo, name, GIT_REMOTE_DOWNLOAD_TAGS_NONE);
	assert_config_entry_value(_repo, "remote.test.tagopt", "--no-tags");

	git_remote_set_autotag(_repo, name, GIT_REMOTE_DOWNLOAD_TAGS_AUTO);
	assert_config_entry_existence(_repo, "remote.test.tagopt", false);
}
Exemplo n.º 9
0
void test_network_remote_delete__remove_branch_upstream_configuration_settings(void)
{
	assert_config_entry_existence(_repo, "branch.mergeless.remote", true);
	assert_config_entry_existence(_repo, "branch.master.remote", true);

	cl_git_pass(git_remote_delete(_remote));

	assert_config_entry_existence(_repo, "branch.mergeless.remote", false);
	assert_config_entry_existence(_repo, "branch.mergeless.merge", false);
	assert_config_entry_existence(_repo, "branch.master.remote", false);
	assert_config_entry_existence(_repo, "branch.master.merge", false);
}
Exemplo n.º 10
0
void test_network_remoterename__renaming_an_inmemory_nameless_remote_notifies_the_inability_to_update_the_fetch_refspec(void)
{
	git_remote *remote;

	char *expected_refspecs[] = {
		"+refs/heads/*:refs/remotes/volatile/*",
		NULL
	};

	assert_config_entry_existence(_repo, "remote.volatile.url", false);

	cl_git_pass(git_remote_new(
		&remote,
		_repo,
		NULL,
		"git://github.com/libgit2/volatile.git",
		"+refs/heads/*:refs/remotes/volatile/*"));

	cl_git_pass(git_remote_rename(remote, "durable", ensure_refspecs, &expected_refspecs));

	git_remote_free(remote);
}