Skip to content

Commit 62af4bd

Browse files
nwc10gitster
authored andcommitted
submodule update: silence underlying fetch with "--quiet"
Commands such as $ git submodule update --quiet --init --depth=1 involving shallow clones, call the shell function fetch_in_submodule, which in turn invokes git fetch. Pass the --quiet option onward there. Signed-off-by: Nicholas Clark <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48bf2fa commit 62af4bd

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

git-submodule.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ fetch_in_submodule () (
420420
cd "$1" &&
421421
if test $# -eq 3
422422
then
423-
echo "$3" | git fetch --stdin ${2:+"$2"}
423+
echo "$3" | git fetch ${GIT_QUIET:+--quiet} --stdin ${2:+"$2"}
424424
else
425-
git fetch ${2:+"$2"}
425+
git fetch ${GIT_QUIET:+--quiet} ${2:+"$2"}
426426
fi
427427
)
428428

t/t7406-submodule-update.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,4 +1037,28 @@ test_expect_success 'submodule update --quiet passes quietness to merge/rebase'
10371037
)
10381038
'
10391039

1040+
test_expect_success 'submodule update --quiet passes quietness to fetch with a shallow clone' '
1041+
test_when_finished "rm -rf super4 super5 super6" &&
1042+
git clone . super4 &&
1043+
(cd super4 &&
1044+
git submodule add --quiet file://"$TRASH_DIRECTORY"/submodule submodule3 &&
1045+
git commit -am "setup submodule3"
1046+
) &&
1047+
(cd submodule &&
1048+
test_commit line6 file
1049+
) &&
1050+
git clone super4 super5 &&
1051+
(cd super5 &&
1052+
git submodule update --quiet --init --depth=1 submodule3 >out 2>err &&
1053+
test_must_be_empty out &&
1054+
test_must_be_empty err
1055+
) &&
1056+
git clone super4 super6 &&
1057+
(cd super6 &&
1058+
git submodule update --init --depth=1 submodule3 >out 2>err &&
1059+
test_file_not_empty out &&
1060+
test_file_not_empty err
1061+
)
1062+
'
1063+
10401064
test_done

0 commit comments

Comments
 (0)