Skip to content

Commit 029c870

Browse files
committed
Merge branch 'mt/rebase-x-quiet'
"git rebase -x --quiet" was not quiet, which was corrected. * mt/rebase-x-quiet: rebase --exec: respect --quiet
2 parents 159f2d5 + 4bdd6b7 commit 029c870

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

pager.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ int term_columns(void)
234234
*/
235235
void term_clear_line(void)
236236
{
237+
if (!isatty(2))
238+
return;
237239
if (is_terminal_dumb())
238240
/*
239241
* Fall back to print a terminal width worth of space

sequencer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3794,12 +3794,13 @@ static int error_failed_squash(struct repository *r,
37943794
return error_with_patch(r, commit, subject, subject_len, opts, 1, 0);
37953795
}
37963796

3797-
static int do_exec(struct repository *r, const char *command_line)
3797+
static int do_exec(struct repository *r, const char *command_line, int quiet)
37983798
{
37993799
struct child_process cmd = CHILD_PROCESS_INIT;
38003800
int dirty, status;
38013801

3802-
fprintf(stderr, _("Executing: %s\n"), command_line);
3802+
if (!quiet)
3803+
fprintf(stderr, _("Executing: %s\n"), command_line);
38033804
cmd.use_shell = 1;
38043805
strvec_push(&cmd.args, command_line);
38053806
strvec_push(&cmd.env, "GIT_CHERRY_PICK_HELP");
@@ -5014,7 +5015,7 @@ static int pick_commits(struct repository *r,
50145015
if (!opts->verbose)
50155016
term_clear_line();
50165017
*end_of_arg = '\0';
5017-
res = do_exec(r, arg);
5018+
res = do_exec(r, arg, opts->quiet);
50185019
*end_of_arg = saved;
50195020

50205021
if (res) {

t/t3400-rebase.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ test_expect_success 'rebase --merge -q is quiet' '
235235
test_must_be_empty output.out
236236
'
237237

238+
test_expect_success 'rebase --exec -q is quiet' '
239+
git checkout -B quiet topic &&
240+
git rebase --exec true -q main >output.out 2>&1 &&
241+
test_must_be_empty output.out
242+
'
243+
238244
test_expect_success 'Rebase a commit that sprinkles CRs in' '
239245
(
240246
echo "One" &&

0 commit comments

Comments
 (0)