* [PATCH] submodule sync: Update "submodule.<name>.url" for empty directories
@ 2010-10-08 1:07 Andreas Köhler
0 siblings, 0 replies; only message in thread
From: Andreas Köhler @ 2010-10-08 1:07 UTC (permalink / raw)
To: git; +Cc: Andreas Köhler
If a submodule directory has not been filled by "git submodule update"
yet, then "git submodule sync" must still update the super-project's
configuration for submodule.<name>.url.
This situation occurs when switching between branches with a module from
different urls and other branches without the submodule.
Signed-off-by: Andreas Köhler <andi5.py@gmx.net>
---
git-submodule.sh | 5 +++--
t/t7403-submodule-sync.sh | 12 +++++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index 9ebbab7..c291eed 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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)
diff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh
index 02522f9..e5b1953 100755
--- a/t/t7403-submodule-sync.sh
+++ b/t/t7403-submodule-sync.sh
@@ -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' '
@@ -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
--
1.7.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-08 1:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-08 1:07 [PATCH] submodule sync: Update "submodule.<name>.url" for empty directories Andreas Köhler
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).