git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] submodule sync: Update "submodule.<name>.url"
@ 2010-08-18 10:01 David Aguilar
  2010-08-18 10:45 ` Johannes Sixt
  0 siblings, 1 reply; 4+ messages in thread
From: David Aguilar @ 2010-08-18 10:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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>
---
 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..be7e478 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -840,9 +840,10 @@ cmd_sync()
 		then
 		(
 			clear_local_git_env
+			say "Synchronizing submodule url for '$name'"
+			git config submodule."$name".url "$url"
 			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.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] submodule sync: Update "submodule.<name>.url"
  2010-08-18 10:01 [PATCH] submodule sync: Update "submodule.<name>.url" David Aguilar
@ 2010-08-18 10:45 ` Johannes Sixt
  2010-08-18 15:46   ` David Aguilar
  2010-08-18 15:58   ` [PATCH v2] " David Aguilar
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Sixt @ 2010-08-18 10:45 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, git

Am 8/18/2010 12:01, schrieb David Aguilar:
> @@ -840,9 +840,10 @@ cmd_sync()
>  		then
>  		(
>  			clear_local_git_env
> +			say "Synchronizing submodule url for '$name'"
> +			git config submodule."$name".url "$url"

This git config applies to the super module, right? As such, shouldn't it
happen before you clear_local_git_env?

>  			cd "$path"
>  			remote=$(get_default_remote)
> -			say "Synchronizing submodule url for '$name'"
>  			git config remote."$remote".url "$url"
>  		)

-- Hannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] submodule sync: Update "submodule.<name>.url"
  2010-08-18 10:45 ` Johannes Sixt
@ 2010-08-18 15:46   ` David Aguilar
  2010-08-18 15:58   ` [PATCH v2] " David Aguilar
  1 sibling, 0 replies; 4+ messages in thread
From: David Aguilar @ 2010-08-18 15:46 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

On Wed, Aug 18, 2010 at 12:45:54PM +0200, Johannes Sixt wrote:
> Am 8/18/2010 12:01, schrieb David Aguilar:
> > @@ -840,9 +840,10 @@ cmd_sync()
> >  		then
> >  		(
> >  			clear_local_git_env
> > +			say "Synchronizing submodule url for '$name'"
> > +			git config submodule."$name".url "$url"
> 
> This git config applies to the super module, right? As such, shouldn't it
> happen before you clear_local_git_env?


Good catch, thanks.  I'll resend.


> 
> >  			cd "$path"
> >  			remote=$(get_default_remote)
> > -			say "Synchronizing submodule url for '$name'"
> >  			git config remote."$remote".url "$url"
> >  		)
> 
> -- Hannes

-- 

	David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] submodule sync: Update "submodule.<name>.url"
  2010-08-18 10:45 ` Johannes Sixt
  2010-08-18 15:46   ` David Aguilar
@ 2010-08-18 15:58   ` David Aguilar
  1 sibling, 0 replies; 4+ messages in thread
From: David Aguilar @ 2010-08-18 15:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Sixt

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

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-18 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 10:01 [PATCH] submodule sync: Update "submodule.<name>.url" David Aguilar
2010-08-18 10:45 ` Johannes Sixt
2010-08-18 15:46   ` David Aguilar
2010-08-18 15:58   ` [PATCH v2] " David Aguilar

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 NNTP newsgroup(s).