]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule update: silence underlying merge/rebase with "--quiet"
authorTheodore Dubois <tbodt@google.com>
Wed, 30 Sep 2020 19:50:53 +0000 (12:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Oct 2020 15:50:24 +0000 (08:50 -0700)
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>
git-submodule.sh
t/t7406-submodule-update.sh

index 43eb6051d23f90cccc94c1fb4c58ad14d4ece3e6..7dc44e3c4673ea9ba9e0a1afaf343615fe45d4f7 100755 (executable)
@@ -465,7 +465,7 @@ cmd_update()
                        GIT_QUIET=1
                        ;;
                -v)
-                       GIT_QUIET=0
+                       unset GIT_QUIET
                        ;;
                --progress)
                        progress=1
@@ -639,13 +639,13 @@ cmd_update()
                                say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
                                ;;
                        rebase)
-                               command="git rebase"
+                               command="git rebase ${GIT_QUIET:+--quiet}"
                                die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
                                say_msg="$(eval_gettext "Submodule path '\$displaypath': rebased into '\$sha1'")"
                                must_die_on_failure=yes
                                ;;
                        merge)
-                               command="git merge"
+                               command="git merge ${GIT_QUIET:+--quiet}"
                                die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$displaypath'")"
                                say_msg="$(eval_gettext "Submodule path '\$displaypath': merged in '\$sha1'")"
                                must_die_on_failure=yes
index aa19ff3a2e2dca17dcc4d0834008d374885c4272..acb8766ac260a6d85f1806bdc65c01d9c79013ba 100755 (executable)
@@ -1022,4 +1022,16 @@ test_expect_success 'git clone passes the parallel jobs config on to submodules'
        rm -rf super4
 '
 
+test_expect_success 'submodule update --quiet passes quietness to merge/rebase' '
+       (cd super &&
+        test_commit -C rebasing message &&
+        git submodule update --rebase --quiet >out 2>err &&
+        test_must_be_empty out &&
+        test_must_be_empty err &&
+        git submodule update --rebase -v >out 2>err &&
+        test_file_not_empty out &&
+        test_must_be_empty err
+       )
+'
+
 test_done