From: Patrick Steinhardt <ps@pks.im>
To: Matheus Tavares <matheus.tavb@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
johannes.schindelin@gmx.de, newren@gmail.com,
Rodrigo Siqueira <siqueirajordao@riseup.net>
Subject: Re: [PATCH] rebase -x: don't print "Executing:" msgs with --quiet
Date: Fri, 16 Aug 2024 10:26:34 +0200 [thread overview]
Message-ID: <Zr8NOh-gMuhp-p0M@tanuki> (raw)
In-Reply-To: <767ea219e3365303535c8b5f0d8eadb28b5e872e.1723778779.git.matheus.tavb@gmail.com>
On Fri, Aug 16, 2024 at 12:26:19AM -0300, Matheus Tavares wrote:
> `rebase --exec` doesn't obey --quiet and end up printing a few messages
s/end/ends/
> about the cmd being executed:
s/cmd/command/
> git rebase HEAD~3 --quiet --exec "printf foo >/dev/null"
> Executing: printf foo >/dev/null
> Executing: printf foo >/dev/null
> Executing: printf foo >/dev/null
>
> Let's fix that.
>
> Suggested-by: Rodrigo Siqueira <siqueirajordao@riseup.net>
> Signed-off-by: Matheus Tavares <matheus.tavb@gmail.com>
> ---
> sequencer.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 0291920f0b..d5824b41c1 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3793,12 +3793,14 @@ static int error_failed_squash(struct repository *r,
> return error_with_patch(r, commit, subject, subject_len, opts, 1, 0);
> }
>
> -static int do_exec(struct repository *r, const char *command_line)
> +static int do_exec(struct repository *r, const char *command_line, int quiet)
> {
> struct child_process cmd = CHILD_PROCESS_INIT;
> int dirty, status;
>
> - fprintf(stderr, _("Executing: %s\n"), command_line);
> + if (!quiet) {
> + fprintf(stderr, _("Executing: %s\n"), command_line);
> + }
We don't typically use braces around single-line statements, so they
should be removed here.
> cmd.use_shell = 1;
> strvec_push(&cmd.args, command_line);
> strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");
> @@ -5013,7 +5015,7 @@ static int pick_commits(struct repository *r,
> if (!opts->verbose)
> term_clear_line();
> *end_of_arg = '\0';
> - res = do_exec(r, arg);
> + res = do_exec(r, arg, opts->quiet);
> *end_of_arg = saved;
>
> if (res) {
Do we also want to add a test for this fix?
Other than those nits the fix looks obviously correct to me, thanks!
Patrick
next prev parent reply other threads:[~2024-08-16 8:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 3:26 [PATCH] rebase -x: don't print "Executing:" msgs with --quiet Matheus Tavares
2024-08-16 6:20 ` Elijah Newren
2024-08-16 8:26 ` Patrick Steinhardt [this message]
2024-08-16 17:34 ` Junio C Hamano
2024-08-16 22:48 ` [PATCH v2] " Matheus Tavares
2024-08-17 11:22 ` Junio C Hamano
2024-08-18 13:03 ` Matheus Tavares Bernardino
2024-08-19 13:57 ` Phillip Wood
2024-08-19 20:17 ` Junio C Hamano
2024-08-20 22:23 ` Matheus Tavares Bernardino
2024-08-19 15:41 ` Junio C Hamano
2024-08-21 1:31 ` [PATCH v3] rebase --exec: respect --quiet Matheus Tavares
2024-08-21 16:00 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zr8NOh-gMuhp-p0M@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=matheus.tavb@gmail.com \
--cc=newren@gmail.com \
--cc=siqueirajordao@riseup.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox