[PATCH] git-submodule.sh: Always initialize $url variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When git submodule init was called, the $url variable was not initialized
properly for submodules which have already been initialized. This led
to two problems.

First, when all of the submodules were initialized, each showed an empty url
instead of the actual url.

Second, when previously initialized submodules were printed after newly
added submodules, the displayed urls were incorrect.

Cc: Jens Lehmann <Jens.Lehmann@xxxxxx>
Cc: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Nicolas Viennot <nicolas@xxxxxxxxxxx>
Signed-off-by: Sid Nair <sidnair09@xxxxxxxxx>
---
 git-submodule.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 64a70d6..92fd6e2 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -396,11 +396,11 @@ cmd_init()
 	module_list "$@" |
 	while read mode sha1 stage sm_path
 	do
-		# Skip already registered paths
 		name=$(module_name "$sm_path") || exit
+		url=$(git config -f .gitmodules submodule."$name".url)
+		# Skip already registered paths
 		if test -z "$(git config "submodule.$name.url")"
 		then
-			url=$(git config -f .gitmodules submodule."$name".url)
 			test -z "$url" &&
 			die "$(eval_gettext "No url found for submodule path '\$sm_path' in .gitmodules")"
 
-- 
1.7.8.6

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]