submodule: add --progress option to add command
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Casey Fitzpatrick committed
May 3, 2018 at 06:53 UTC
6d33e1c28210bacf2e664b55b2feb255991e0ad5
3 files changed
+27
-1
Documentation/git-submodule.txt
+7
@@ -239,6 +239,13 @@ OPTIONS
239
--quiet::
240
Only print error messages.
241
242
+--progress::
243
+ This option is only valid for add and update commands.
244
+ Progress status is reported on the standard error stream
245
+ by default when it is attached to a terminal, unless -q
246
+ is specified. This flag forces progress status even if the
247
+ standard error stream is not directed to a terminal.
248
+
249
--all::
250
This option is only valid for the deinit command. Unregister all
251
submodules in the working tree.
git-submodule.sh
+4
-1
@@ -117,6 +117,9 @@ cmd_add()
117
-q|--quiet)
118
GIT_QUIET=1
119
;;
120
+ --progress)
121
+ progress=1
122
+ ;;
123
--reference)
124
case "$2" in '') usage ;; esac
125
reference_path=$2
@@ -255,7 +258,7 @@ or you are unsure what this means choose another name with the '--name' option."
258
eval_gettextln "Reactivating local git directory for submodule '\$sm_name'."
259
fi
260
fi
258
- git submodule--helper clone ${GIT_QUIET:+--quiet} --prefix "$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo" ${reference:+"$reference"} ${depth:+"$depth"} || exit
261
+ 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
262
(
263
sanitize_submodule_env
264
cd "$sm_path" &&
t/t7400-submodule-basic.sh
+16
@@ -126,6 +126,22 @@ test_expect_success 'submodule add' '
126
test_cmp empty untracked
127
'
128
129
+test_create_repo parent &&
130
+test_commit -C parent one
131
+
132
+test_expect_success 'redirected submodule add does not show progress' '
133
+ git -C addtest submodule add "file://$submodurl/parent" submod-redirected \
134
+ 2>err &&
135
+ ! grep % err &&
136
+ test_i18ngrep ! "Checking connectivity" err
137
+'
138
+
139
+test_expect_success 'redirected submodule add --progress does show progress' '
140
+ git -C addtest submodule add --progress "file://$submodurl/parent" \
141
+ submod-redirected-progress 2>err && \
142
+ grep % err
143
+'
144
+
145
test_expect_success 'submodule add to .gitignored path fails' '
146
(
147
cd addtest-ignore &&