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

[PATCH 2/3] submodule: add --progress option to add command

From
Casey Fitzpatrick <kcghost@gmail.com>
Date
May 2, 2018, 00:55 UTC
Message-ID
<20180502005528.19740-3-kcghost@gmail.com>
In-Reply-To
<20180502005528.19740-1-kcghost@gmail.com>

The '--progress' was introduced in 72c5f88311d (clone: pass --progress decision to recursive submodules, 2016-09-22) to fix the progress reporting of the clone command. Also add the progress option to the 'submodule add' command. The update command already supports the progress flag, but it is not documented.

Signed-off-by: Casey Fitzpatrick <kcghost@gmail.com>
---
 Documentation/git-submodule.txt |  7 +++++++
 git-submodule.sh                |  5 ++++-
 t/t7400-submodule-basic.sh      | 16 ++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 71c5618e8..d1ebe32e8 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -239,6 +239,13 @@ OPTIONS
 --quiet::
 	Only print error messages.
 
+--progress::
+	This option is only valid for add and update commands.
+	Progress status is reported on the standard error stream
+	by default when it is attached to a terminal, unless -q
+	is specified. This flag forces progress status even if the
+	standard error stream is not directed to a terminal.
+
 --all::
 	This option is only valid for the deinit command. Unregister all
 	submodules in the working tree.
diff --git a/git-submodule.sh b/git-submodule.sh
index 262547968..39c241a1d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -117,6 +117,9 @@ cmd_add()
 		-q|--quiet)
 			GIT_QUIET=1
 			;;
+		--progress)
+			progress=1
+			;;
 		--reference)
 			case "$2" in '') usage ;; esac
 			reference_path=$2
@@ -255,7 +258,7 @@ or you are unsure what this means choose another name with the '--name' option."
 				eval_gettextln "Reactivating local git directory for submodule '\$sm_name'."
 			fi
 		fi
-		git submodule--helper clone ${GIT_QUIET:+--quiet} --prefix "$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo" ${reference:+"$reference"} ${depth:+"$depth"} || exit
+		git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+"--progress"} --prefix "$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo" ${reference:+"$reference"} ${depth:+"$depth"} || exit
 		(
 			sanitize_submodule_env
 			cd "$sm_path" &&
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index a39e69a3e..b5b4922ab 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -126,6 +126,22 @@ test_expect_success 'submodule add' '
 	test_cmp empty untracked
 '
 
+test_create_repo parent &&
+test_commit -C parent one
+
+test_expect_success 'redirected submodule add does not show progress' '
+	git -C addtest submodule add "file://$submodurl/parent" submod-redirected \
+		2>err &&
+	! grep % err &&
+	test_i18ngrep ! "Checking connectivity" err
+'
+
+test_expect_success 'redirected submodule add --progress does show progress' '
+	git -C addtest submodule add --progress "file://$submodurl/parent" \
+		submod-redirected-progress 2>err && \
+	grep % err
+'
+
 test_expect_success 'submodule add to .gitignored path fails' '
 	(
 		cd addtest-ignore &&
-- 
2.17.0.1.ge0414f29c.dirty
Previous: Casey FitzpatrickNext: Casey Fitzpatrick
Message 25 of 29 in “git-submodule is missing --dissociate option”
  1. Casey FitzpatrickApr 30, 2018
  2. Casey FitzpatrickApr 30, 2018
  3. Ævar Arnfjörð BjarmasonApr 30, 2018
  4. Junio C HamanoMay 2, 2018
  5. Stefan BellerApr 30, 2018
  6. Casey FitzpatrickApr 30, 2018
  7. 0/2 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 1, 2018
  8. 1/2 submodule: Add --progress option to add commandCasey Fitzpatrick, May 1, 2018
  9. Stefan BellerMay 1, 2018
  10. Casey FitzpatrickMay 1, 2018
  11. 2/2 submodule: Add --dissociate option to add/update commandsCasey Fitzpatrick, May 1, 2018
  12. Stefan BellerMay 1, 2018
  13. Eric SunshineMay 1, 2018
  14. Casey FitzpatrickMay 1, 2018
  15. Stefan BellerMay 1, 2018
  16. 0/3 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 2, 2018
  17. 1/3 submodule: clean up subsititions in scriptCasey Fitzpatrick, May 2, 2018
  18. 2/3 submodule: add --progress option to add commandCasey Fitzpatrick, May 2, 2018
  19. 3/3 submodule: add --dissociate option to add/update commandsCasey Fitzpatrick, May 2, 2018
  20. Casey FitzpatrickMay 2, 2018
  21. 0/3 Add --progress and --dissociate to git submoduleCasey Fitzpatrick, May 2, 2018
  22. 1/3 submodule: clean up subsititions in scriptCasey Fitzpatrick, May 2, 2018
  23. Junio C HamanoMay 2, 2018
  24. Casey FitzpatrickMay 3, 2018
  25. 2/3 submodule: add --progress option to add commandCasey Fitzpatrick, May 2, 2018
  26. 3/3 submodule: add --dissociate option to add/update commandsCasey Fitzpatrick, May 2, 2018
  27. Junio C HamanoMay 2, 2018
  28. Casey FitzpatrickMay 2, 2018
  29. Junio C HamanoMay 2, 2018

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.