[PATCH 08/11] PREVIEW: remote: remove support for migrating ancient remotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By now, everybody will have moved on... no need to burden ourselves with
now-obsolete code.

Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
---
 Documentation/git-remote.txt |  4 ----
 builtin/remote.c             | 27 ---------------------
 t/t5505-remote.sh            | 57 --------------------------------------------
 3 files changed, 88 deletions(-)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 577b969c1bd..746fdd27ced 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -84,10 +84,6 @@ will always behave as if `--mirror` was passed.
 
 Rename the remote named <old> to <new>. All remote-tracking branches and
 configuration settings for the remote are updated.
-+
-In case <old> and <new> are the same, and <old> is a file under
-`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to
-the configuration file format.
 
 'remove'::
 'rm'::
diff --git a/builtin/remote.c b/builtin/remote.c
index addf97ad293..c3502f24223 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -574,30 +574,6 @@ static int read_remote_branches(const char *refname,
 	return 0;
 }
 
-static int migrate_file(struct remote *remote)
-{
-	struct strbuf buf = STRBUF_INIT;
-	int i;
-
-	strbuf_addf(&buf, "remote.%s.url", remote->name);
-	for (i = 0; i < remote->url_nr; i++)
-		git_config_set_multivar(buf.buf, remote->url[i], "^$", 0);
-	strbuf_reset(&buf);
-	strbuf_addf(&buf, "remote.%s.push", remote->name);
-	for (i = 0; i < remote->push_refspec_nr; i++)
-		git_config_set_multivar(buf.buf, remote->push_refspec[i], "^$", 0);
-	strbuf_reset(&buf);
-	strbuf_addf(&buf, "remote.%s.fetch", remote->name);
-	for (i = 0; i < remote->fetch_refspec_nr; i++)
-		git_config_set_multivar(buf.buf, remote->fetch_refspec[i], "^$", 0);
-	if (remote->origin == REMOTE_REMOTES)
-		unlink_or_warn(git_path("remotes/%s", remote->name));
-	else if (remote->origin == REMOTE_BRANCHES)
-		unlink_or_warn(git_path("branches/%s", remote->name));
-
-	return 0;
-}
-
 static int mv(int argc, const char **argv)
 {
 	struct option options[] = {
@@ -621,9 +597,6 @@ static int mv(int argc, const char **argv)
 	if (!remote_is_configured(oldremote, 1))
 		die(_("No such remote: %s"), rename.old);
 
-	if (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)
-		return migrate_file(oldremote);
-
 	newremote = remote_get(rename.new);
 	if (remote_is_configured(newremote, 1))
 		die(_("remote %s already exists."), rename.new);
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 4fd66760c75..857950ac8ee 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -798,63 +798,6 @@ Pull: refs/heads/master:refs/heads/origin
 Pull: refs/heads/next:refs/heads/origin2
 EOF
 
-test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
-	git clone one five &&
-	origin_url=$(pwd)/one &&
-	(
-		cd five &&
-		git remote remove origin &&
-		mkdir -p .git/remotes &&
-		cat ../remotes_origin >.git/remotes/origin &&
-		git remote rename origin origin &&
-		test_path_is_missing .git/remotes/origin &&
-		test "$(git config remote.origin.url)" = "$origin_url" &&
-		cat >push_expected <<-\EOF &&
-		refs/heads/master:refs/heads/upstream
-		refs/heads/next:refs/heads/upstream2
-		EOF
-		cat >fetch_expected <<-\EOF &&
-		refs/heads/master:refs/heads/origin
-		refs/heads/next:refs/heads/origin2
-		EOF
-		git config --get-all remote.origin.push >push_actual &&
-		git config --get-all remote.origin.fetch >fetch_actual &&
-		test_cmp push_expected push_actual &&
-		test_cmp fetch_expected fetch_actual
-	)
-'
-
-test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
-	git clone one six &&
-	origin_url=$(pwd)/one &&
-	(
-		cd six &&
-		git remote rm origin &&
-		mkdir -p .git/branches &&
-		echo "$origin_url" >.git/branches/origin &&
-		git remote rename origin origin &&
-		test_path_is_missing .git/branches/origin &&
-		test "$(git config remote.origin.url)" = "$origin_url" &&
-		test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin" &&
-		test "$(git config remote.origin.push)" = "HEAD:refs/heads/master"
-	)
-'
-
-test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)' '
-	git clone one seven &&
-	(
-		cd seven &&
-		git remote rm origin &&
-		mkdir .git/branches &&
-		echo "quux#foom" > .git/branches/origin &&
-		git remote rename origin origin &&
-		test_path_is_missing .git/branches/origin &&
-		test "$(git config remote.origin.url)" = "quux" &&
-		test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"
-		test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
-	)
-'
-
 test_expect_success 'remote prune to cause a dangling symref' '
 	git clone one eight &&
 	(
-- 
2.12.2.windows.2.800.gede8f145e06





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]