git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] submodule: move update configuration variable further up

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Aug 11, 2011, 17:51 UTC
Message-ID
<5dcb346470d84b03276ec1d3693ab21a48681952.1312923673.git.hvoigt@hvoigt.net>
In-Reply-To
<cover.1312923673.git.hvoigt@hvoigt.net>

Lets always initialize the 'update_module' variable with the final value. This way we allow code which wants to check this configuration early to do so right in the beginning of cmd_update().

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
 git-submodule.sh |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/git-submodule.sh b/git-submodule.sh
index f46862f..e544dbc 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -461,7 +461,13 @@ cmd_update()
 		fi
 		name=$(module_name "$path") || exit
 		url=$(git config submodule."$name".url)
-		update_module=$(git config submodule."$name".update)
+		if ! test -z "$update"
+		then
+			update_module=$update
+		else
+			update_module=$(git config submodule."$name".update)
+		fi
+
 		if test -z "$url"
 		then
 			# Only mention uninitialized submodules when its
@@ -483,11 +489,6 @@ Maybe you want to use 'update --init'?")"
 			die "$(eval_gettext "Unable to find current revision in submodule path '\$path'")"
 		fi
 
-		if ! test -z "$update"
-		then
-			update_module=$update
-		fi
-
 		if test "$subsha1" != "$sha1"
 		then
 			subforce=$force
-- 
1.7.6.435.g741d34
Previous: Heiko VoigtNext: Heiko Voigt
Message 2 of 15 in “Add an update=none option for 'loose' submodules”
  1. 0/2 Add an update=none option for 'loose' submodulesHeiko Voigt, Aug 11, 2011
  2. 1/2 submodule: move update configuration variable further upHeiko Voigt, Aug 11, 2011
  3. 2/2 add update 'none' flag to disable update of submodule by defaultHeiko Voigt, Aug 11, 2011
  4. Junio C HamanoAug 11, 2011
  5. Heiko VoigtAug 11, 2011
  6. Junio C HamanoAug 15, 2011
  7. Heiko VoigtAug 22, 2011
  8. Junio C HamanoAug 22, 2011
  9. Heiko VoigtAug 23, 2011
  10. Jens LehmannAug 23, 2011
  11. Junio C HamanoAug 23, 2011
  12. Heiko VoigtAug 24, 2011
  13. Junio C HamanoAug 26, 2011
  14. Jens LehmannAug 26, 2011
  15. Heiko VoigtAug 24, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.