Merge branch 'mt/rebase-x-quiet'

"git rebase -x --quiet" was not quiet, which was corrected.

* mt/rebase-x-quiet:
  rebase --exec: respect --quiet
This commit is contained in:
Junio C Hamano
2024-08-28 10:31:26 -07:00
3 changed files with 12 additions and 3 deletions

View File

@@ -234,6 +234,8 @@ int term_columns(void)
*/
void term_clear_line(void)
{
if (!isatty(2))
return;
if (is_terminal_dumb())
/*
* Fall back to print a terminal width worth of space

View File

@@ -3794,12 +3794,13 @@ 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");
@@ -5014,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) {

View File

@@ -235,6 +235,12 @@ 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
'
test_expect_success 'Rebase a commit that sprinkles CRs in' '
(
echo "One" &&