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

[PATCH] submodule sync: Update "submodule.<name>.url"

From
David Aguilar <davvid@gmail.com>
Date
Aug 18, 2010, 10:01 UTC
Message-ID
<1282125673-22956-1-git-send-email-davvid@gmail.com>

When "git submodule sync" synchronizes the repository URLs it only updates submodules' .git/config. However, the old URLs still exist in the super-project's .git/config.

Update the super-project's configuration so that commands such as "git submodule update" use the URLs from .gitmodules.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 git-submodule.sh          |    3 ++-
 t/t7403-submodule-sync.sh |    3 +++
 2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 170186f..be7e478 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -840,9 +840,10 @@ cmd_sync()
 		then
 		(
 			clear_local_git_env
+			say "Synchronizing submodule url for '$name'"
+			git config submodule."$name".url "$url"
 			cd "$path"
 			remote=$(get_default_remote)
-			say "Synchronizing submodule url for '$name'"
 			git config remote."$remote".url "$url"
 		)
 		fi
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 7538756..3033c4a 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -58,6 +58,9 @@ test_expect_success '"git submodule sync" should update submodule URLs' '
 	(cd super-clone/submodule &&
 	 git checkout master &&
 	 git pull
+	) &&
+	(cd super-clone &&
+	 test -d "$(git config submodule.submodule.url)"
 	)
 '
 
-- 
1.7.2.1.97.g3235b.dirty
Next: Johannes Sixt
Message 1 of 4 in “submodule sync: Update "submodule.<name>.url"”
  1. submodule sync: Update "submodule.<name>.url"David Aguilar, Aug 18, 2010
  2. Johannes SixtAug 18, 2010
  3. David AguilarAug 18, 2010
  4. submodule sync: Update "submodule.<name>.url"David Aguilar, Aug 18, 2010

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.