Commit 26186b155baf614bcea789d06e17fe7eb13715fe

Carlos Martín Nieto 2014-12-14T21:01:19

fetch: remove the prune setter This option does not get persisted to disk, which makes it different from the rest of the setters. Remove it until we go all the way. We still respect the configuration option, and it's still possible to perform a one-time prune by calling the function.

diff --git a/include/git2/remote.h b/include/git2/remote.h
index 0d4ee99..9f37dc2 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -601,16 +601,6 @@ GIT_EXTERN(void) git_remote_set_autotag(
 GIT_EXTERN(int) git_remote_prune_refs(const git_remote *remote);
 
 /**
- * Set the ref-prune setting
- *
- * @param remote the remote to configure
- * @param value a boolean value
- */
-GIT_EXTERN(void) git_remote_set_prune_refs(
-	git_remote *remote,
-	int value);
-
-/**
  * Give the remote a new name
  *
  * All remote-tracking branches and configuration settings
diff --git a/src/remote.c b/src/remote.c
index 28d7b55..f96aaa3 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1632,11 +1632,6 @@ int git_remote_prune_refs(const git_remote *remote)
 	return remote->prune_refs;
 }
 
-void git_remote_set_prune_refs(git_remote *remote, int value)
-{
-	remote->prune_refs = value;
-}
-
 static int rename_remote_config_section(
 	git_repository *repo,
 	const char *old_name,
diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c
index e2e6b5e..8825339 100644
--- a/tests/network/fetchlocal.c
+++ b/tests/network/fetchlocal.c
@@ -153,10 +153,10 @@ void test_network_fetchlocal__prune_overlapping(void)
 	git_remote_set_callbacks(origin, &callbacks);
 
 	cl_git_pass(git_repository_config(&config, repo));
+	cl_git_pass(git_config_set_bool(config, "remote.origin.prune", true));
 	cl_git_pass(git_config_set_multivar(config, "remote.origin.fetch", "^$", "refs/pull/*/head:refs/remotes/origin/pr/*"));
 
 	cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
-	git_remote_set_prune_refs(origin, 1);
 	git_remote_set_callbacks(origin, &callbacks);
 	cl_git_pass(git_remote_fetch(origin, NULL, NULL, NULL));
 
@@ -170,7 +170,6 @@ void test_network_fetchlocal__prune_overlapping(void)
 	cl_git_pass(git_config_set_multivar(config, "remote.origin.fetch", "^$", "refs/heads/*:refs/remotes/origin/*"));
 
 	cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
-	git_remote_set_prune_refs(origin, true);
 	callbacks.update_tips = update_tips_fail_on_call;
 	git_remote_set_callbacks(origin, &callbacks);
 	cl_git_pass(git_remote_fetch(origin, NULL, NULL, NULL));
@@ -184,7 +183,6 @@ void test_network_fetchlocal__prune_overlapping(void)
 	cl_git_pass(git_config_set_multivar(config, "remote.origin.fetch", "^$", "refs/heads/*:refs/remotes/origin/*"));
 	cl_git_pass(git_config_set_multivar(config, "remote.origin.fetch", "^$", "refs/pull/*/head:refs/remotes/origin/pr/*"));
 	cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
-	git_remote_set_prune_refs(origin, true);
 	callbacks.update_tips = update_tips_fail_on_call;
 	git_remote_set_callbacks(origin, &callbacks);
 	cl_git_pass(git_remote_fetch(origin, NULL, NULL, NULL));
@@ -234,9 +232,9 @@ void test_network_fetchlocal__fetchprune(void)
 	git_reference_free(ref);
 
 	cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN));
-	git_remote_set_prune_refs(origin, 1);
 	git_remote_set_callbacks(origin, &callbacks);
 	cl_git_pass(git_remote_fetch(origin, NULL, NULL, NULL));
+	cl_git_pass(git_remote_prune(origin));
 
 	cl_git_pass(git_reference_list(&refnames, repo));
 	cl_assert_equal_i(18, (int)refnames.count);