git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Casey Fitzpatrick <kcghost@gmail.com>
To: git@vger.kernel.org
Cc: Casey Fitzpatrick <kcghost@gmail.com>
Subject: [PATCH 1/2] submodule: Add --progress option to add command
Date: Tue,  1 May 2018 14:09:07 -0400	[thread overview]
Message-ID: <20180501180908.17443-2-kcghost@gmail.com> (raw)
In-Reply-To: <20180501180908.17443-1-kcghost@gmail.com>

--progress was missing from add command, was only in update.
Add --progress where it makes sense (both clone helper commands).
Add missing documentation entry.
Add test.

Signed-off-by: Casey Fitzpatrick <kcghost@gmail.com>
---
 Documentation/git-submodule.txt |  7 +++++++
 git-submodule.sh                |  5 ++++-
 t/t7400-submodule-basic.sh      | 31 +++++++++++++++++++++++++++++++
 3 files changed, 42 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 24914963c..aa1c0bb67 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -117,6 +117,9 @@ cmd_add()
 		-q|--quiet)
 			GIT_QUIET=1
 			;;
+		--progress)
+			progress="--progress"
+			;;
 		--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..d7225a74b 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -126,6 +126,37 @@ test_expect_success 'submodule add' '
 	test_cmp empty untracked
 '
 
+test_expect_success 'setup test repo' '
+	mkdir parent &&
+	(cd parent && git init &&
+	 echo one >file && git add file &&
+	 git commit -m one)
+'
+
+test_expect_success 'clone -o' '
+	git clone -o foo parent clone-o &&
+	(cd clone-o && git rev-parse --verify refs/remotes/foo/master)
+'
+
+test_expect_success 'redirected submodule add does not show progress' '
+	(
+		cd addtest &&
+		git submodule add "file://$submodurl/parent" submod-redirected \
+			>out 2>err &&
+		! grep % err &&
+		test_i18ngrep ! "Checking connectivity" err
+	)
+'
+
+test_expect_success 'redirected submodule add --progress does show progress' '
+	(
+		cd addtest &&
+		git submodule add --progress "file://$submodurl/parent" \
+			submod-redirected-progress >out 2>err && \
+		grep % err
+	)
+'
+
 test_expect_success 'submodule add to .gitignored path fails' '
 	(
 		cd addtest-ignore &&
-- 
2.17.0.1.ge0414f29c.dirty


  reply	other threads:[~2018-05-01 18:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30  8:29 git-submodule is missing --dissociate option Casey Fitzpatrick
2018-04-30 11:30 ` Casey Fitzpatrick
2018-04-30 13:16   ` Ævar Arnfjörð Bjarmason
2018-05-02  4:32     ` Junio C Hamano
2018-04-30 18:19 ` Stefan Beller
2018-04-30 21:39   ` Casey Fitzpatrick
2018-05-01 18:09     ` [PATCH 0/2] Add --progress and --dissociate to git submodule Casey Fitzpatrick
2018-05-01 18:09       ` Casey Fitzpatrick [this message]
2018-05-01 18:41         ` [PATCH 1/2] submodule: Add --progress option to add command Stefan Beller
2018-05-01 20:48           ` Casey Fitzpatrick
2018-05-01 18:09       ` [PATCH 2/2] submodule: Add --dissociate option to add/update commands Casey Fitzpatrick
2018-05-01 20:23         ` Stefan Beller
2018-05-01 20:25         ` Eric Sunshine
2018-05-01 21:21           ` Casey Fitzpatrick
2018-05-01 18:20       ` [PATCH 0/2] Add --progress and --dissociate to git submodule Stefan Beller
2018-05-02  0:27     ` [PATCH 0/3] " Casey Fitzpatrick
2018-05-02  0:27       ` [PATCH 1/3] submodule: clean up subsititions in script Casey Fitzpatrick
2018-05-02  0:27       ` [PATCH 2/3] submodule: add --progress option to add command Casey Fitzpatrick
2018-05-02  0:27       ` [PATCH 3/3] submodule: add --dissociate option to add/update commands Casey Fitzpatrick
2018-05-02  0:40         ` Casey Fitzpatrick
2018-05-02  0:55     ` [PATCH 0/3] Add --progress and --dissociate to git submodule Casey Fitzpatrick
2018-05-02  0:55       ` [PATCH 1/3] submodule: clean up subsititions in script Casey Fitzpatrick
2018-05-02  5:59         ` Junio C Hamano
2018-05-03 10:46           ` Casey Fitzpatrick
2018-05-02  0:55       ` [PATCH 2/3] submodule: add --progress option to add command Casey Fitzpatrick
2018-05-02  0:55       ` [PATCH 3/3] submodule: add --dissociate option to add/update commands Casey Fitzpatrick
2018-05-02  4:37       ` [PATCH 0/3] Add --progress and --dissociate to git submodule Junio C Hamano
2018-05-02  8:54         ` Casey Fitzpatrick
2018-05-02  4:34   ` git-submodule is missing --dissociate option Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501180908.17443-2-kcghost@gmail.com \
    --to=kcghost@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).