summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Pratik Karki <predatoramigo@gmail.com>2018-08-08 21:21:33 +0545
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-10-11 14:16:05 +0900
commitcda614e489a4da3a4824af2f2e17379131e1f048 (patch)
treef8f310ae7c2f89b51cb72676e50f98f808bb8c05
parentbuiltin rebase: fast-forward to onto if it is a proper descendant (diff)
downloadtgif-cda614e489a4da3a4824af2f2e17379131e1f048.tar.xz
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 <predatoramigo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/rebase.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 7522be837c..600788bf72 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -98,6 +98,7 @@ struct rebase_options {
int allow_empty_message;
int rebase_merges, rebase_cousins;
char *strategy, *strategy_opts;
+ struct strbuf git_format_patch_opt;
};
static int is_interactive(struct rebase_options *opts)
@@ -379,6 +380,8 @@ static int run_specific_rebase(struct rebase_options *opts)
add_var(&script_snippet, "rebase_root", opts->root ? "t" : "");
add_var(&script_snippet, "squash_onto",
opts->squash_onto ? oid_to_hex(opts->squash_onto) : "");
+ add_var(&script_snippet, "git_format_patch_opt",
+ opts->git_format_patch_opt.buf);
switch (opts->type) {
case REBASE_AM:
@@ -667,6 +670,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
.git_am_opt = STRBUF_INIT,
.allow_rerere_autoupdate = -1,
.allow_empty_message = 1,
+ .git_format_patch_opt = STRBUF_INIT,
};
const char *branch_name;
int ret, flags, total_argc, in_progress = 0;
@@ -1069,6 +1073,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (options.root && !options.onto_name)
imply_interactive(&options, "--root without --onto");
+ if (isatty(2) && options.flags & REBASE_NO_QUIET)
+ strbuf_addstr(&options.git_format_patch_opt, " --progress");
+
switch (options.type) {
case REBASE_MERGE:
case REBASE_INTERACTIVE: