While 'quiet' and 'interactive' may sound like antonyms, the interactive machinery actually has logic that implements several interactive_rebase=implied cases (--exec, --keep-empty, --rebase-merges) which won't pop up an editor. Further, we want to make the interactive machinery also take over for git-rebase--merge and become the default merge strategy, so it makes sense for these other cases to have a quiet option. git-rebase--interactive was already somewhat quieter than git-rebase--merge and git-rebase--am, possibly because cherry-pick has just traditionally been quieter. As such, we only drop a few informational messages -- "Rebasing (n/m)" and "Succesfully rebased..." Signed-off-by: Elijah Newren <newren@xxxxxxxxx> --- git-rebase--interactive.sh | 9 +++++++-- git-rebase.sh | 2 +- sequencer.c | 19 +++++++++++++------ sequencer.h | 1 + 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 06a7b79307..1f2401f702 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -139,8 +139,12 @@ mark_action_done () { if test "$last_count" != "$new_count" then last_count=$new_count - eval_gettext "Rebasing (\$new_count/\$total)"; printf "\r" - test -z "$verbose" || echo + if test -z "$GIT_QUIET" + then + eval_gettext "Rebasing (\$new_count/\$total)"; + printf "\r" + test -z "$verbose" || echo + fi fi } @@ -713,6 +717,7 @@ Commit or stash your changes, and then run "$hook" rebase < "$rewritten_list" true # we don't care if this hook failed fi && + test -z "$GIT_QUIET" && warn "$(eval_gettext "Successfully rebased and updated \$head_name.")" return 1 # not failure; just to break the do_rest loop diff --git a/git-rebase.sh b/git-rebase.sh index 7d1612b31b..b639c0d4fe 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -136,7 +136,7 @@ write_basic_state () { echo "$head_name" > "$state_dir"/head-name && echo "$onto" > "$state_dir"/onto && echo "$orig_head" > "$state_dir"/orig-head && - echo "$GIT_QUIET" > "$state_dir"/quiet && + test t = "$GIT_QUIET" && : > "$state_dir"/quiet test t = "$verbose" && : > "$state_dir"/verbose test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy test -n "$strategy_opts" && echo "$strategy_opts" > \ diff --git a/sequencer.c b/sequencer.c index a2843e3906..d418d40bee 100644 --- a/sequencer.c +++ b/sequencer.c @@ -143,6 +143,7 @@ static GIT_PATH_FUNC(rebase_path_refs_to_delete, "rebase-merge/refs-to-delete") static GIT_PATH_FUNC(rebase_path_gpg_sign_opt, "rebase-merge/gpg_sign_opt") static GIT_PATH_FUNC(rebase_path_orig_head, "rebase-merge/orig-head") static GIT_PATH_FUNC(rebase_path_verbose, "rebase-merge/verbose") +static GIT_PATH_FUNC(rebase_path_quiet, "rebase-merge/quiet") static GIT_PATH_FUNC(rebase_path_signoff, "rebase-merge/signoff") static GIT_PATH_FUNC(rebase_path_head_name, "rebase-merge/head-name") static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto") @@ -2251,6 +2252,9 @@ static int read_populate_opts(struct replay_opts *opts) if (file_exists(rebase_path_verbose())) opts->verbose = 1; + if (file_exists(rebase_path_quiet())) + opts->quiet = 1; + if (file_exists(rebase_path_signoff())) { opts->allow_ff = 0; opts->signoff = 1; @@ -3171,10 +3175,11 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts) fprintf(f, "%d\n", todo_list->done_nr); fclose(f); } - fprintf(stderr, "Rebasing (%d/%d)%s", - todo_list->done_nr, - todo_list->total_nr, - opts->verbose ? "\n" : "\r"); + if (!opts->quiet) + fprintf(stderr, "Rebasing (%d/%d)%s", + todo_list->done_nr, + todo_list->total_nr, + opts->verbose ? "\n" : "\r"); } unlink(rebase_path_message()); unlink(rebase_path_author_script()); @@ -3385,8 +3390,10 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts) } apply_autostash(opts); - fprintf(stderr, "Successfully rebased and updated %s.\n", - head_ref.buf); + if (!opts->quiet) + fprintf(stderr, + "Successfully rebased and updated %s.\n", + head_ref.buf); strbuf_release(&buf); strbuf_release(&head_ref); diff --git a/sequencer.h b/sequencer.h index c5787c6b56..da652a421f 100644 --- a/sequencer.h +++ b/sequencer.h @@ -33,6 +33,7 @@ struct replay_opts { int allow_empty_message; int keep_redundant_commits; int verbose; + int quiet; int mainline; -- 2.18.0.rc1.12.g2996b9442d