git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 11, 2017, 13:47 UTC
Message-ID
<86474db5654befa3880a33c10eb62075c6e2a5e0.1494509599.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1494509599.git.johannes.schindelin@gmx.de>

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 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
Previous: Johannes SchindelinNext: Junio C Hamano
Message 47 of 62 in “Start retiring .git/remotes/ and .git/branches/ for good”
  1. 00/11 Start retiring .git/remotes/ and .git/branches/ for goodJohannes Schindelin, May 11, 2017
  2. 05/11 Revert "Revert "Don't create the $GIT_DIR/branches directory on init""Johannes Schindelin, May 11, 2017
  3. Stefan BellerMay 11, 2017
  4. 04/11 remote: warn loud and clear when .git/remotes/ is *still* usedJohannes Schindelin, May 11, 2017
  5. 01/11 git-parse-remote: fix highly misleading man pageJohannes Schindelin, May 11, 2017
  6. Stefan BellerMay 11, 2017
  7. Johannes SchindelinMay 11, 2017
  8. 0/5 Remove now-unused git-parse-remoteÆvar Arnfjörð Bjarmason, Nov 11, 2020
  9. Jeff KingNov 11, 2020
  10. Junio C HamanoNov 11, 2020
  11. Ævar Arnfjörð BjarmasonNov 12, 2020
  12. Jeff KingNov 12, 2020
  13. How do I "git fetch" with a custom <refspec> but a default remote?Ævar Arnfjörð Bjarmason, Nov 12, 2020
  14. Jeff KingNov 12, 2020
  15. Chris TorekNov 12, 2020
  16. Jeff KingNov 12, 2020
  17. Junio C HamanoNov 12, 2020
  18. Ævar Arnfjörð BjarmasonNov 14, 2020
  19. 1/5 parse-remote: remove unused GIT_DIR variableÆvar Arnfjörð Bjarmason, Nov 11, 2020
  20. 2/5 parse-remote: remove long-dead rebase codeÆvar Arnfjörð Bjarmason, Nov 11, 2020
  21. 4/5 parse-remote: move used code to git-submodule.shÆvar Arnfjörð Bjarmason, Nov 11, 2020
  22. 5/5 parse-remote: remove this now-unused libraryÆvar Arnfjörð Bjarmason, Nov 11, 2020
  23. Junio C HamanoNov 11, 2020
  24. 0/2 Retire git-parse-remoteJunio C Hamano, Nov 12, 2020
  25. 1/2 parse-remote: move used code to git-submodule.shJunio C Hamano, Nov 12, 2020
  26. 2/2 parse-remote: remove this now-unused libraryJunio C Hamano, Nov 12, 2020
  27. Jeff KingNov 12, 2020
  28. Junio C HamanoNov 12, 2020
  29. Ævar Arnfjörð BjarmasonNov 13, 2020
  30. 0/3 submodule sh->C & retire parse-remoteÆvar Arnfjörð Bjarmason, Nov 14, 2020
  31. 1/3 submodule: use "fetch" logic instead of custom remote discoveryÆvar Arnfjörð Bjarmason, Nov 14, 2020
  32. Junio C HamanoNov 16, 2020
  33. 3/3 parse-remote: remove this now-unused libraryÆvar Arnfjörð Bjarmason, Nov 14, 2020
  34. Junio C HamanoNov 16, 2020
  35. Ævar Arnfjörð BjarmasonNov 17, 2020
  36. 2/3 submodule: remove sh function in favor of helperÆvar Arnfjörð Bjarmason, Nov 14, 2020
  37. 3/5 parse-remote: remove long-dead git-pull.sh codeÆvar Arnfjörð Bjarmason, Nov 11, 2020
  38. 03/11 remote: warn loud and clear when .git/branches/ is *still* usedJohannes Schindelin, May 11, 2017
  39. 09/11 PREVIEW: t5515: remove .git/remotes/ and .git/branches/ testsJohannes Schindelin, May 11, 2017
  40. 02/11 Documentation: really deprecate .git/remotes/ and .git/branches/Johannes Schindelin, May 11, 2017
  41. 10/11 PREVIEW: t0060: stop testing support for .git/remotes/ and .git/branches/Johannes Schindelin, May 11, 2017
  42. 11/11 PREVIEW: remove support for .git/remotes/ and .git/branches/Johannes Schindelin, May 11, 2017
  43. Stefan BellerMay 11, 2017
  44. Johannes SchindelinMay 11, 2017
  45. 06/11 PREVIEW: t5510: convert .git/remotes/ test to use a regular remoteJohannes Schindelin, May 11, 2017
  46. 07/11 PREVIEW: t5516: stop testing .git/branches/ functionalityJohannes Schindelin, May 11, 2017
  47. 08/11 PREVIEW: remote: remove support for migrating ancient remotesJohannes Schindelin, May 11, 2017
  48. Junio C HamanoMay 12, 2017
  49. Johannes SchindelinMay 12, 2017
  50. Junio C HamanoMay 16, 2017
  51. Ævar Arnfjörð BjarmasonMay 16, 2017
  52. Junio C HamanoMay 16, 2017
  53. Ævar Arnfjörð BjarmasonMay 16, 2017
  54. Junio C HamanoMay 17, 2017
  55. Junio C HamanoMay 12, 2017
  56. Johannes SchindelinMay 12, 2017
  57. Jonathan NiederMay 12, 2017
  58. Junio C HamanoMay 13, 2017
  59. Junio C HamanoMay 12, 2017
  60. Johannes SchindelinMay 15, 2017
  61. Jeff KingMay 12, 2017
  62. Johannes SchindelinMay 12, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.