Skip to content

Commit 6dc7317

Browse files
prertikgitster
authored andcommitted
builtin rebase: show progress when connected to a terminal
In this commit, we pass `--progress` to the `format-patch` command if stderr is connected to an interactive terminal, unless we're in quiet mode. This `--progress` option will be used in `format-patch` to show progress reports on stderr as patches are generated. Signed-off-by: Pratik Karki <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 62fddd5 commit 6dc7317

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builtin/rebase.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct rebase_options {
9898
int allow_empty_message;
9999
int rebase_merges, rebase_cousins;
100100
char *strategy, *strategy_opts;
101+
struct strbuf git_format_patch_opt;
101102
};
102103

103104
static int is_interactive(struct rebase_options *opts)
@@ -379,6 +380,8 @@ static int run_specific_rebase(struct rebase_options *opts)
379380
add_var(&script_snippet, "rebase_root", opts->root ? "t" : "");
380381
add_var(&script_snippet, "squash_onto",
381382
opts->squash_onto ? oid_to_hex(opts->squash_onto) : "");
383+
add_var(&script_snippet, "git_format_patch_opt",
384+
opts->git_format_patch_opt.buf);
382385

383386
switch (opts->type) {
384387
case REBASE_AM:
@@ -667,6 +670,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
667670
.git_am_opt = STRBUF_INIT,
668671
.allow_rerere_autoupdate = -1,
669672
.allow_empty_message = 1,
673+
.git_format_patch_opt = STRBUF_INIT,
670674
};
671675
const char *branch_name;
672676
int ret, flags, total_argc, in_progress = 0;
@@ -1068,6 +1072,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
10681072
if (options.root && !options.onto_name)
10691073
imply_interactive(&options, "--root without --onto");
10701074

1075+
if (isatty(2) && options.flags & REBASE_NO_QUIET)
1076+
strbuf_addstr(&options.git_format_patch_opt, " --progress");
1077+
10711078
switch (options.type) {
10721079
case REBASE_MERGE:
10731080
case REBASE_INTERACTIVE:

0 commit comments

Comments
 (0)