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

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

 



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@xxxxxxxxx>
---

Changes since v1:
We now call clear_local_git_env after configuring
the super project (thanks Johannes).

 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..9ebbab7 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -839,10 +839,11 @@ cmd_sync()
 		if test -e "$path"/.git
 		then
 		(
+			say "Synchronizing submodule url for '$name'"
+			git config submodule."$name".url "$url"
 			clear_local_git_env
 			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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]