Skip to content

Commit

Permalink
Merge branch 'ak/submodule-sync' into maint
Browse files Browse the repository at this point in the history
* ak/submodule-sync:
  submodule sync: Update "submodule.<name>.url" for empty directories
  • Loading branch information
Junio C Hamano committed Nov 24, 2010
2 parents e7b9b80 + 33f072f commit a274f5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,12 @@ cmd_sync()
;;
esac

say "Synchronizing submodule url for '$name'"
git config submodule."$name".url "$url"

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)
Expand Down
12 changes: 11 additions & 1 deletion t/t7403-submodule-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ test_expect_success setup '
git commit -m "submodule"
) &&
git clone super super-clone &&
(cd super-clone && git submodule update --init)
(cd super-clone && git submodule update --init) &&
git clone super empty-clone &&
(cd empty-clone && git submodule init)
'

test_expect_success 'change submodule' '
Expand Down Expand Up @@ -64,4 +66,12 @@ test_expect_success '"git submodule sync" should update submodule URLs' '
)
'

test_expect_success '"git submodule sync" should update submodule URLs if not yet cloned' '
(cd empty-clone &&
git pull &&
git submodule sync &&
test -d "$(git config submodule.submodule.url)"
)
'

test_done

0 comments on commit a274f5b

Please sign in to comment.