Re: [PATCH] rebase -x: don't print "Executing:" msgs with --quiet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 15, 2024 at 8:26 PM Matheus Tavares <matheus.tavb@xxxxxxxxx> wrote:
>
> `rebase --exec` doesn't obey --quiet and end up printing a few messages
> about the cmd being executed:
>
>   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@xxxxxxxxxx>
> Signed-off-by: Matheus Tavares <matheus.tavb@xxxxxxxxx>
> ---
>  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);
> +       }
>         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) {
> --
> 2.46.0

Makes sense and looks good to me.  It's kind surprising just how many
places we've ignored --quiet over the years...anyway, thanks for
fixing another one of them.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux