# [PATCH v2] Propagate --quiet on submodule update to merge/rebase

5 messages from 2020-09-30 to 2020-10-01. Participants: Theodore Dubois, Junio C Hamano, Eric Sunshine, Jonathan Nieder.
Thread: https://gitlist.dev/t/54329

## Theodore Dubois, 2020-09-30 19:50

Subject: [PATCH v2] Propagate --quiet on submodule update to merge/rebase
Message-ID: <20200930195052.118199-1-tbodt@google.com>
URL: https://gitlist.dev/e/20200930195052.118199-1-tbodt%40google.com

```
Without this, commands such as
git pull --rebase --recurse-submodules --quiet
might produce non-quiet output from the merge or rebase.

Also fix the parsing of git submodule update -v. Setting GIT_QUIET to 0
has the same effect as setting GIT_QUIET to 1, because
${GIT_QUIET:+--quiet} only checks whether GIT_QUIET is set or unset.

Signed-off-by: Theodore Dubois <tbodt@google.com>
---
 git-submodule.sh            |  6 +++---
 t/t7406-submodule-update.sh | 12 ++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git git-submodule.sh git-submodule.sh
index 6fb12585cb..7ce52872b7 100755
--- git-submodule.sh
+++ git-submodule.sh
@@ -440,7 +440,7 @@ cmd_update()
 			GIT_QUIET=1
 			;;
 		-v)
-			GIT_QUIET=0
+			unset GIT_QUIET
 			;;
 		--progress)
 			progress=1
@@ -614,13 +614,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
diff --git t/t7406-submodule-update.sh t/t7406-submodule-update.sh
index aa19ff3a2e..acb8766ac2 100755
--- t/t7406-submodule-update.sh
+++ t/t7406-submodule-update.sh
@@ -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
-- 
2.28.0.709.gb0816b6eb0-goog


```

## Junio C Hamano, 2020-09-30 20:58

Subject: Re: [PATCH v2] Propagate --quiet on submodule update to merge/rebase
Message-ID: <xmqqzh57f0dh.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqqzh57f0dh.fsf%40gitster.c.googlers.com
In-Reply-To: <20200930195052.118199-1-tbodt@google.com>

```
Theodore Dubois <tbodt@google.com> writes:

> Without this, commands such as
> git pull --rebase --recurse-submodules --quiet
> might produce non-quiet output from the merge or rebase.
>
> Also fix the parsing of git submodule update -v. Setting GIT_QUIET to 0
> has the same effect as setting GIT_QUIET to 1, because
> ${GIT_QUIET:+--quiet} only checks whether GIT_QUIET is set or unset.

Thanks.

Will queue with the following log message.

    submodule update: silence underlying merge/rebase "--quiet" is given
    
    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" (instead of "1" which is used when "--quiet" is given) has
    the same effect to pass "--quiet" to underlying commands.
    
    Signed-off-by: Theodore Dubois <tbodt@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>


```

## Eric Sunshine, 2020-09-30 21:04

Subject: Re: [PATCH v2] Propagate --quiet on submodule update to merge/rebase
Message-ID: <CAPig+cSoJf-=Po39qocKttH2TQNGW9wVov6cQgb5zbZjZz63Bw@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcSoJf-%3DPo39qocKttH2TQNGW9wVov6cQgb5zbZjZz63Bw%40mail.gmail.com
In-Reply-To: <xmqqzh57f0dh.fsf@gitster.c.googlers.com>

```
On Wed, Sep 30, 2020 at 4:58 PM Junio C Hamano <gitster@pobox.com> wrote:
> Will queue with the following log message.
>
>     submodule update: silence underlying merge/rebase "--quiet" is given

Probably want to insert "when" in there.

>     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" (instead of "1" which is used when "--quiet" is given) has
>     the same effect to pass "--quiet" to underlying commands.

Perhaps:

    ... to "0", rather than unsetting it, still results in "--quiet"
    being passed to underlying commands.

```

## Jonathan Nieder, 2020-10-01 05:38

Subject: Re: [PATCH v2] Propagate --quiet on submodule update to merge/rebase
Message-ID: <20201001053803.GC2930867@google.com>
URL: https://gitlist.dev/e/20201001053803.GC2930867%40google.com
In-Reply-To: <xmqqzh57f0dh.fsf@gitster.c.googlers.com>

```
Junio C Hamano wrote:
> Theodore Dubois <tbodt@google.com> writes:

>> Without this, commands such as
>> git pull --rebase --recurse-submodules --quiet
>> might produce non-quiet output from the merge or rebase.
>>
>> Also fix the parsing of git submodule update -v. Setting GIT_QUIET to 0
>> has the same effect as setting GIT_QUIET to 1, because
>> ${GIT_QUIET:+--quiet} only checks whether GIT_QUIET is set or unset.
>
> Thanks.
>
> Will queue with the following log message.
>
>     submodule update: silence underlying merge/rebase "--quiet" is given

Missing 'when' before '"--quiet"', as Eric noticed.

Aside from that,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks, all.

```

## Junio C Hamano, 2020-10-01 15:49

Subject: Re: [PATCH v2] Propagate --quiet on submodule update to merge/rebase
Message-ID: <xmqqd022c5eg.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqqd022c5eg.fsf%40gitster.c.googlers.com
In-Reply-To: <20201001053803.GC2930867@google.com>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

> Junio C Hamano wrote:
>> Theodore Dubois <tbodt@google.com> writes:
>
>>> Without this, commands such as
>>> git pull --rebase --recurse-submodules --quiet
>>> might produce non-quiet output from the merge or rebase.
>>>
>>> Also fix the parsing of git submodule update -v. Setting GIT_QUIET to 0
>>> has the same effect as setting GIT_QUIET to 1, because
>>> ${GIT_QUIET:+--quiet} only checks whether GIT_QUIET is set or unset.
>>
>> Thanks.
>>
>> Will queue with the following log message.
>>
>>     submodule update: silence underlying merge/rebase "--quiet" is given
>
> Missing 'when' before '"--quiet"', as Eric noticed.
>
> Aside from that,
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
>
> Thanks, all.

I just noticed that our names were on the original change that
introduced the broken GIT_QUIET=0; hopefully this time around we did
a better job at reviewing the change? ;-)

Thanks.

```
