Skip to content

Commit 7e60407

Browse files
jlehmanngitster
authored andcommitted
submodule: update and add must honor --quiet flag
When using the --quiet flag "git submodule update" and "git submodule add" didn't behave as the documentation stated. They printed progress output from the clone, even though they should only print error messages. Fix that by passing the -q flag to git clone in module_clone() when the GIT_QUIET variable is set. Two tests in t7400 have been modified to test that behavior. Reported-by: Daniel Holtmann-Rice <[email protected]> Signed-off-by: Jens Lehmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2579e1d commit 7e60407

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

git-submodule.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,17 @@ module_clone()
121121
path=$1
122122
url=$2
123123
reference="$3"
124+
quiet=
125+
if test -n "$GIT_QUIET"
126+
then
127+
quiet=-q
128+
fi
124129

125130
if test -n "$reference"
126131
then
127-
git-clone "$reference" -n "$url" "$path"
132+
git-clone $quiet "$reference" -n "$url" "$path"
128133
else
129-
git-clone -n "$url" "$path"
134+
git-clone $quiet -n "$url" "$path"
130135
fi ||
131136
die "Clone of '$url' into submodule path '$path' failed"
132137
}

t/t7400-submodule-basic.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ test_expect_success 'submodule add' '
7575
7676
(
7777
cd addtest &&
78-
git submodule add "$submodurl" submod &&
78+
git submodule add -q "$submodurl" submod >actual &&
79+
test ! -s actual &&
7980
git submodule init
8081
) &&
8182
@@ -273,7 +274,8 @@ test_expect_success 'update should work when path is an empty dir' '
273274
echo "$rev1" >expect &&
274275
275276
mkdir init &&
276-
git submodule update &&
277+
git submodule update -q >update.out &&
278+
test ! -s update.out &&
277279
278280
inspect init &&
279281
test_cmp expect head-sha1

0 commit comments

Comments
 (0)