Skip to content

Commit d70f0f8

Browse files
committed
Merge branch 'ak/submodule-sync' into jch
* ak/submodule-sync: submodule sync: Update "submodule.<name>.url" for empty directories
2 parents d37b56c + 33f072f commit d70f0f8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

git-submodule.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,12 @@ cmd_sync()
833833
;;
834834
esac
835835

836+
say "Synchronizing submodule url for '$name'"
837+
git config submodule."$name".url "$url"
838+
836839
if test -e "$path"/.git
837840
then
838841
(
839-
say "Synchronizing submodule url for '$name'"
840-
git config submodule."$name".url "$url"
841842
clear_local_git_env
842843
cd "$path"
843844
remote=$(get_default_remote)

t/t7403-submodule-sync.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ test_expect_success setup '
2323
git commit -m "submodule"
2424
) &&
2525
git clone super super-clone &&
26-
(cd super-clone && git submodule update --init)
26+
(cd super-clone && git submodule update --init) &&
27+
git clone super empty-clone &&
28+
(cd empty-clone && git submodule init)
2729
'
2830

2931
test_expect_success 'change submodule' '
@@ -64,4 +66,12 @@ test_expect_success '"git submodule sync" should update submodule URLs' '
6466
)
6567
'
6668

69+
test_expect_success '"git submodule sync" should update submodule URLs if not yet cloned' '
70+
(cd empty-clone &&
71+
git pull &&
72+
git submodule sync &&
73+
test -d "$(git config submodule.submodule.url)"
74+
)
75+
'
76+
6777
test_done

0 commit comments

Comments
 (0)