git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Propagate --quiet on submodule update to merge/rebase
@ 2020-09-30  7:47 Theodore Dubois
  2020-09-30 19:24 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Dubois @ 2020-09-30  7:47 UTC (permalink / raw)
  To: git; +Cc: Theodore Dubois

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

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

diff --git git-submodule.sh git-submodule.sh
index 6fb12585cb..5c22b17221 100755
--- git-submodule.sh
+++ git-submodule.sh
@@ -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..5213e47af8 100755
--- t/t7406-submodule-update.sh
+++ t/t7406-submodule-update.sh
@@ -1022,4 +1022,13 @@ 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
+	)
+'
+
 test_done
-- 
2.28.0.709.gb0816b6eb0-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Propagate --quiet on submodule update to merge/rebase
  2020-09-30  7:47 [PATCH] Propagate --quiet on submodule update to merge/rebase Theodore Dubois
@ 2020-09-30 19:24 ` Junio C Hamano
  2020-09-30 19:44   ` Theodore Dubois
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2020-09-30 19:24 UTC (permalink / raw)
  To: Theodore Dubois; +Cc: git

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.
>
> Signed-off-by: Theodore Dubois <tbodt@google.com>
> ---
>  git-submodule.sh            | 4 ++--
>  t/t7406-submodule-update.sh | 9 +++++++++
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git git-submodule.sh git-submodule.sh
> index 6fb12585cb..5c22b17221 100755
> --- git-submodule.sh
> +++ git-submodule.sh
> @@ -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

This is not the problem this patch introduces, but the way GIT_QUIET
variable is set up does not allow us to do the above so nicely, I
suspect.  Wouldn't the above change make "git submodule update -v"
invoke the underlying commands with "--quiet" option?


The problematic piece of code is this part:

        cmd_update()
        {
                # parse $args after "submodule ... update".
                while test $# -ne 0
                do
                        case "$1" in
                        -q|--quiet)
                                GIT_QUIET=1
                                ;;
                        -v)
                                GIT_QUIET=0
                                ;;
                        --progress)
                                progress=1
                                ;;


I think this is the only place in the script that GIT_QUIET is set
to 0, but all the places that refer to the variable do not even
check the value held in it.  Makes me wonder if it was used
differently back when e84c3cf3dc3 was written.

    ... goes and looks at the offending commit ...

I think the right fix could have been "unset GIT_QUIET" instead of
assigning 0 that means the same thing as GIT_QUIET=1

In any case, the posted patch is a good first step but it makes the
existing problem worse.  Let's fix GIT_QUIET=0 at the same time.

Thanks.

> diff --git t/t7406-submodule-update.sh t/t7406-submodule-update.sh
> index aa19ff3a2e..5213e47af8 100755
> --- t/t7406-submodule-update.sh
> +++ t/t7406-submodule-update.sh
> @@ -1022,4 +1022,13 @@ 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 &&

IOW, I suspect that this test will still pass with s/--quiet/-v/ .

> +	 test_must_be_empty out &&
> +	 test_must_be_empty err
> +	)
> +'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Propagate --quiet on submodule update to merge/rebase
  2020-09-30 19:24 ` Junio C Hamano
@ 2020-09-30 19:44   ` Theodore Dubois
  2020-09-30 20:34     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Theodore Dubois @ 2020-09-30 19:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

> This is not the problem this patch introduces, but the way GIT_QUIET
> variable is set up does not allow us to do the above so nicely, I
> suspect.  Wouldn't the above change make "git submodule update -v"
> invoke the underlying commands with "--quiet" option?

Interesting. I didn't check every setting of GIT_QUIET, just looked at the first few and assumed the rest would be the same. The "git submodule--helper update-clone" invocation also has this problem. I'll resend with "unset GIT_QUIET".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Propagate --quiet on submodule update to merge/rebase
  2020-09-30 19:44   ` Theodore Dubois
@ 2020-09-30 20:34     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2020-09-30 20:34 UTC (permalink / raw)
  To: Theodore Dubois; +Cc: git

Theodore Dubois <tbodt@google.com> writes:

>> This is not the problem this patch introduces, but the way GIT_QUIET
>> variable is set up does not allow us to do the above so nicely, I
>> suspect.  Wouldn't the above change make "git submodule update -v"
>> invoke the underlying commands with "--quiet" option?
>
> Interesting. I didn't check every setting of GIT_QUIET, just
> looked at the first few and assumed the rest would be the
> same. The "git submodule--helper update-clone" invocation also has
> this problem. I'll resend with "unset GIT_QUIET".

It seems set_branch also is written with a strange sense of humor.
It pays attention to GIT_QUIET but never sets it itself.

Thanks.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-30 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30  7:47 [PATCH] Propagate --quiet on submodule update to merge/rebase Theodore Dubois
2020-09-30 19:24 ` Junio C Hamano
2020-09-30 19:44   ` Theodore Dubois
2020-09-30 20:34     ` Junio C Hamano

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).