[PATCH 4/8] submodule update: pass --require-init and --init

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

 



From: Glen Choo <chooglen@xxxxxxxxxx>

git-submodule.sh::cmd_update() makes "--require-init" imply "--init".
Move this logic into "git submodule--helper update" instead, and append
both options to `opts`.

Signed-off-by: Glen Choo <chooglen@xxxxxxxxxx>
---
 builtin/submodule--helper.c | 4 ++++
 git-submodule.sh            | 9 ++-------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index c6c2ba1b6dc..a40f9f143e8 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2642,6 +2642,10 @@ static int module_update(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, prefix, module_update_options,
 			     git_submodule_helper_usage, 0);
 
+	if (opt.require_init) {
+		opt.init = 1;
+	}
+
 	if (filter_options.choice && !opt.init) {
 		usage_with_options(git_submodule_helper_usage,
 				   module_update_options);
diff --git a/git-submodule.sh b/git-submodule.sh
index 7418fd5bf51..f61d12ccd21 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -34,8 +34,6 @@ branch=
 force=
 cached=
 recursive=
-init=
-require_init=
 files=
 update=
 prefix=
@@ -254,11 +252,10 @@ cmd_update()
 			opts="$opts $1"
 			;;
 		-i|--init)
-			init=1
+			opts="$opts $1"
 			;;
 		--require-init)
-			init=1
-			require_init=1
+			opts="$opts $1"
 			;;
 		--remote)
 			opts="$opts $1"
@@ -344,11 +341,9 @@ cmd_update()
 
 	git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \
 		${GIT_QUIET:+--quiet} \
-		${init:+--init} \
 		${wt_prefix:+--prefix "$wt_prefix"} \
 		${prefix:+--recursive-prefix "$prefix"} \
 		${update:+--update "$update"} \
-		${require_init:+--require-init} \
 		$opts \
 		-- \
 		"$@"
-- 
gitgitgadget




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

  Powered by Linux