Commit c8dbec4803aa7d8300f19a97431bbf631ac5a392

Carlos Martín Nieto 2013-09-16T18:42:53

clone: remove the autotag option Downloading all tags is part of what makes it a clone instead of simply a fetch.

diff --git a/include/git2/clone.h b/include/git2/clone.h
index c3936f6..c80bf9b 100644
--- a/include/git2/clone.h
+++ b/include/git2/clone.h
@@ -54,8 +54,6 @@ GIT_BEGIN_DECL
  *   means use the transport autodetected from the URL.
  * - `remote_callbacks` may be used to specify custom progress callbacks for
  *   the origin remote before the fetch is initiated.
- * - `remote_autotag` may be used to specify the autotag setting before the
- *   initial fetch.  The default is GIT_REMOTE_DOWNLOAD_TAGS_ALL.
  * - `checkout_branch` gives the name of the branch to checkout. NULL means
  *   use the remote's HEAD.
  */
@@ -74,7 +72,6 @@ typedef struct git_clone_options {
     git_transport_flags_t transport_flags;
 	git_transport *transport;
 	git_remote_callbacks *remote_callbacks;
-	git_remote_autotag_option_t remote_autotag;
 	const char* checkout_branch;
 } git_clone_options;
 
diff --git a/src/clone.c b/src/clone.c
index 13f2a8e..d720907 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -310,7 +310,6 @@ static int create_and_configure_origin(
 	if ((error = git_remote_create(&origin, repo, options->remote_name, url)) < 0)
 		goto on_error;
 
-	git_remote_set_autotag(origin, options->remote_autotag);
 	/*
 	 * Don't write FETCH_HEAD, we'll check out the remote tracking
 	 * branch ourselves based on the server's default.
@@ -364,13 +363,11 @@ static int setup_remotes_and_fetch(
 
 	git_remote_set_update_fetchhead(origin, 0);
 
-	/* If the download_tags value has not been specified, then make sure to
-		* download tags as well. It is set here because we want to download tags
-		* on the initial clone, but do not want to persist the value in the
-		* configuration file.
-		*/
-	if (origin->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_AUTO &&
-		((retcode = git_remote_add_fetch(origin, "refs/tags/*:refs/tags/*")) < 0))
+	/* Make sure to download all tags as well. It is set here because
+	 * we want to download tags on the initial clone, but do not
+	 * want to persist the value in the configuration file.
+	 */
+	if((retcode = git_remote_add_fetch(origin, "refs/tags/*:refs/tags/*")) < 0)
 		goto on_error;
 
 	if ((retcode = git_remote_fetch(origin)) < 0)
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c
index 5b9faa6..3824916 100644
--- a/tests-clar/clone/nonetwork.c
+++ b/tests-clar/clone/nonetwork.c
@@ -171,39 +171,6 @@ void test_clone_nonetwork__custom_push_spec(void)
 	cl_assert_equal_s("refs/heads/foo", git_refspec_dst(actual_fs));
 }
 
-void test_clone_nonetwork__custom_autotag(void)
-{
-	git_remote *origin;
-	git_strarray tags = {0};
-
-	g_options.remote_autotag = GIT_REMOTE_DOWNLOAD_TAGS_NONE;
-	cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
-
-	cl_git_pass(git_tag_list(&tags, g_repo));
-	cl_assert_equal_sz(0, tags.count);
-
-	cl_git_pass(git_remote_load(&origin, g_repo, "origin"));
-	cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_NONE, origin->download_tags);
-
-	git_strarray_free(&tags);
-	git_remote_free(origin);
-}
-
-void test_clone_nonetwork__custom_autotag_tags_all(void)
-{
-	git_strarray tags = {0};
-	git_remote *origin;
-
-	g_options.remote_autotag = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
-	cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
-
-	cl_git_pass(git_remote_load(&origin, g_repo, "origin"));
-	cl_assert_equal_i(GIT_REMOTE_DOWNLOAD_TAGS_ALL, origin->download_tags);
-
-	git_strarray_free(&tags);
-	git_remote_free(origin);
-}
-
 void test_clone_nonetwork__cope_with_already_existing_directory(void)
 {
 	p_mkdir("./foo", GIT_DIR_MODE);