Skip to content

Commit 6d33e1c

Browse files
kcghostgitster
authored andcommitted
submodule: add --progress option to add command
The '--progress' was introduced in 72c5f88 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c7199e3 commit 6d33e1c

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

Documentation/git-submodule.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ OPTIONS
239239
--quiet::
240240
Only print error messages.
241241

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+
242249
--all::
243250
This option is only valid for the deinit command. Unregister all
244251
submodules in the working tree.

git-submodule.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ cmd_add()
117117
-q|--quiet)
118118
GIT_QUIET=1
119119
;;
120+
--progress)
121+
progress=1
122+
;;
120123
--reference)
121124
case "$2" in '') usage ;; esac
122125
reference_path=$2
@@ -255,7 +258,7 @@ or you are unsure what this means choose another name with the '--name' option."
255258
eval_gettextln "Reactivating local git directory for submodule '\$sm_name'."
256259
fi
257260
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
259262
(
260263
sanitize_submodule_env
261264
cd "$sm_path" &&

t/t7400-submodule-basic.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ test_expect_success 'submodule add' '
126126
test_cmp empty untracked
127127
'
128128

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+
129145
test_expect_success 'submodule add to .gitignored path fails' '
130146
(
131147
cd addtest-ignore &&

0 commit comments

Comments
 (0)