Skip to content

Commit 0b9dca4

Browse files
davvidgitster
authored andcommitted
submodule sync: Update "submodule.<name>.url"
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 64fdc08 commit 0b9dca4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

git-submodule.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,11 @@ cmd_sync()
839839
if test -e "$path"/.git
840840
then
841841
(
842+
say "Synchronizing submodule url for '$name'"
843+
git config submodule."$name".url "$url"
842844
clear_local_git_env
843845
cd "$path"
844846
remote=$(get_default_remote)
845-
say "Synchronizing submodule url for '$name'"
846847
git config remote."$remote".url "$url"
847848
)
848849
fi

t/t7403-submodule-sync.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ test_expect_success '"git submodule sync" should update submodule URLs' '
5858
(cd super-clone/submodule &&
5959
git checkout master &&
6060
git pull
61+
) &&
62+
(cd super-clone &&
63+
test -d "$(git config submodule.submodule.url)"
6164
)
6265
'
6366

0 commit comments

Comments
 (0)