[PATCH 1/2] submodule: Add --progress option to add command
From: Casey Fitzpatrick <hidden>
Date: 2018-05-01 18:15:47
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
--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 <redacted> --- 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