From: Junio C Hamano <gitster@pobox.com>
To: Matheus Tavares <matheus.tavb@gmail.com>
Cc: git@vger.kernel.org, johannes.schindelin@gmx.de,
newren@gmail.com, ps@pks.im,
Lincoln Yuji <lincolnyuji@hotmail.com>,
Rodrigo Siqueira <siqueirajordao@riseup.net>
Subject: Re: [PATCH v2] rebase -x: don't print "Executing:" msgs with --quiet
Date: Sat, 17 Aug 2024 04:22:22 -0700 [thread overview]
Message-ID: <xmqq34n3jswh.fsf@gitster.g> (raw)
In-Reply-To: <be3c968b0d9085843cd9ce67e85aadfaaafa69c8.1723848510.git.matheus.tavb@gmail.com> (Matheus Tavares's message of "Fri, 16 Aug 2024 19:48:30 -0300")
Matheus Tavares <matheus.tavb@gmail.com> writes:
> `rebase --exec` doesn't obey --quiet and ends up printing a few messages
> about the command being executed:
> ...
> -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);
This is very much understandable and match what the proposed log
message explained.
> @@ -4902,7 +4903,7 @@ static int pick_one_commit(struct repository *r,
> if (item->command == TODO_EDIT) {
> struct commit *commit = item->commit;
> if (!res) {
> - if (!opts->verbose)
> + if (!opts->quiet && !opts->verbose)
> term_clear_line();
This is not, though. The original says "if not verbose, clear the
line", so presumably calling the term_clear_line() makes it _less_
verbose. The reasoning needs to be explained.
I actually would have expected that this message ...
> fprintf(stderr, _("Stopped at %s... %.*s\n"),
> short_commit_name(r, commit), item->arg_len, arg);
... goes away when opts->quiet is in effect ;-).
Another thing, if _all_ calls to term_clear_line() is done under the
same "not quiet, and not verbose" condition, perhaps it is easier to
follow the resulting code if a helper function that takes a single
argument, opts, and does eomthing like:
static void helper(struct replay_opts *opts)
{
/*
* explain why we shouldn't call term_clear_line()
* under opts->quiet or opts->verbose here.
*/
if (opts->quiet || opts->verbose)
return;
term_clear_line();
}
Once we understand why it makes sense to treat quiet and verbose the
same way with repect to clearing the line, we can properly fill the
"explain" above, and give an intuitive name to the helper, which will
help readers understand the callers, too.
> diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
> index ae34bfad60..15b3228c6e 100755
> --- a/t/t3400-rebase.sh
> +++ b/t/t3400-rebase.sh
> @@ -235,6 +235,13 @@ test_expect_success 'rebase --merge -q is quiet' '
> test_must_be_empty output.out
> '
>
> +test_expect_success 'rebase --exec -q is quiet' '
> + git checkout -B quiet topic &&
> + git rebase --exec true -q main >output.out 2>&1 &&
> + test_must_be_empty output.out
> +
> +'
Thanks.
next prev parent reply other threads:[~2024-08-17 11:23 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
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 [this message]
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=xmqq34n3jswh.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=lincolnyuji@hotmail.com \
--cc=matheus.tavb@gmail.com \
--cc=newren@gmail.com \
--cc=ps@pks.im \
--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;
as well as URLs for NNTP newsgroup(s).