submodule update: silence underlying merge/rebase with "--quiet"
Commands such as $ git pull --rebase --recurse-submodules --quiet produce non-quiet output from the merge or rebase. Pass the --quiet option down when invoking "rebase" and "merge". Also fix the parsing of git submodule update -v. When e84c3cf3 (git-submodule.sh: accept verbose flag in cmd_update to be non-quiet, 2018-08-14) taught "git submodule update" to take "--quiet", it apparently did not know how ${GIT_QUIET:+--quiet} works, and reviewers seem to have missed that setting the variable to "0", rather than unsetting it, still results in "--quiet" being passed to underlying commands. Signed-off-by: Theodore Dubois <tbodt@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Theodore Dubois committed
Sep 30, 2020 at 12:50 UTC
3ad0401e9e6d3e243a21a3f376e36453572dcf0d
2 files changed
+15
-3
git-submodule.sh
+3
-3
@@ -465,7 +465,7 @@ cmd_update()
465
GIT_QUIET=1
466
;;
467
-v)
468
- GIT_QUIET=0
468
+ unset GIT_QUIET
469
;;
470
--progress)
471
progress=1
@@ -639,13 +639,13 @@ cmd_update()
639
say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
640
;;
641
rebase)
642
- command="git rebase"
642
+ command="git rebase ${GIT_QUIET:+--quiet}"
643
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
644
say_msg="$(eval_gettext "Submodule path '\$displaypath': rebased into '\$sha1'")"
645
must_die_on_failure=yes
646
;;
647
merge)
648
- command="git merge"
648
+ command="git merge ${GIT_QUIET:+--quiet}"
649
die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$displaypath'")"
650
say_msg="$(eval_gettext "Submodule path '\$displaypath': merged in '\$sha1'")"
651
must_die_on_failure=yes
t/t7406-submodule-update.sh
+12
@@ -1022,4 +1022,16 @@ test_expect_success 'git clone passes the parallel jobs config on to submodules'
1022
rm -rf super4
1023
'
1024
1025
+test_expect_success 'submodule update --quiet passes quietness to merge/rebase' '
1026
+ (cd super &&
1027
+ test_commit -C rebasing message &&
1028
+ git submodule update --rebase --quiet >out 2>err &&
1029
+ test_must_be_empty out &&
1030
+ test_must_be_empty err &&
1031
+ git submodule update --rebase -v >out 2>err &&
1032
+ test_file_not_empty out &&
1033
+ test_must_be_empty err
1034
+ )
1035
+'
1036
+
1037
test_done