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 <flyingtabmow@gmail.com> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jens Lehmann committed Jul 26, 2011 at 23:39 UTC 7e60407f7a36bd1f7fd505f9aa9580a837fbb190
2 files changed +11 -4
git-submodule.sh
+7 -2
@@ -121,12 +121,17 @@ module_clone()
121 path=$1
122 url=$2
123 reference="$3"
124 + quiet=
125 + if test -n "$GIT_QUIET"
126 + then
127 + quiet=-q
128 + fi
129
130 if test -n "$reference"
131 then
127 - git-clone "$reference" -n "$url" "$path"
132 + git-clone $quiet "$reference" -n "$url" "$path"
133 else
129 - git-clone -n "$url" "$path"
134 + git-clone $quiet -n "$url" "$path"
135 fi ||
136 die "Clone of '$url' into submodule path '$path' failed"
137 }
t/t7400-submodule-basic.sh
+4 -2
@@ -75,7 +75,8 @@ test_expect_success 'submodule add' '
75
76 (
77 cd addtest &&
78 - git submodule add "$submodurl" submod &&
78 + git submodule add -q "$submodurl" submod >actual &&
79 + test ! -s actual &&
80 git submodule init
81 ) &&
82
@@ -273,7 +274,8 @@ test_expect_success 'update should work when path is an empty dir' '
274 echo "$rev1" >expect &&
275
276 mkdir init &&
276 - git submodule update &&
277 + git submodule update -q >update.out &&
278 + test ! -s update.out &&
279
280 inspect init &&
281 test_cmp expect head-sha1