Skip to content

Commit 3ad0401

Browse files
tbodtgitster
authored andcommitted
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 e84c3cf (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47ae905 commit 3ad0401

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

git-submodule.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ cmd_update()
465465
GIT_QUIET=1
466466
;;
467467
-v)
468-
GIT_QUIET=0
468+
unset GIT_QUIET
469469
;;
470470
--progress)
471471
progress=1
@@ -639,13 +639,13 @@ cmd_update()
639639
say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
640640
;;
641641
rebase)
642-
command="git rebase"
642+
command="git rebase ${GIT_QUIET:+--quiet}"
643643
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
644644
say_msg="$(eval_gettext "Submodule path '\$displaypath': rebased into '\$sha1'")"
645645
must_die_on_failure=yes
646646
;;
647647
merge)
648-
command="git merge"
648+
command="git merge ${GIT_QUIET:+--quiet}"
649649
die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$displaypath'")"
650650
say_msg="$(eval_gettext "Submodule path '\$displaypath': merged in '\$sha1'")"
651651
must_die_on_failure=yes

t/t7406-submodule-update.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,4 +1022,16 @@ test_expect_success 'git clone passes the parallel jobs config on to submodules'
10221022
rm -rf super4
10231023
'
10241024

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+
10251037
test_done

0 commit comments

Comments
 (0)