git-rebase, sequencer: extend --quiet option for the interactive machinery
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. The rewrite of interactive rebase in C added a quiet option, though it only turns stats off. Since we want to make the interactive machinery also take over for git-rebase--merge, it should fully implement the --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 "Successfully rebased..." Also, for simplicity, remove the differences in how quiet and verbose options were recorded. Having one be signalled by the presence of a "verbose" file in the state_dir, while the other was signalled by the contents of a "quiet" file was just weirdly inconsistent. (This inconsistency pre-dated the rewrite into C.) Make them consistent by having them both key off the presence of the file. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
45339f74ef
commit
899b49c446
@ -185,10 +185,7 @@ static int read_basic_state(struct rebase_options *opts)
|
|||||||
if (get_oid(buf.buf, &opts->orig_head))
|
if (get_oid(buf.buf, &opts->orig_head))
|
||||||
return error(_("invalid orig-head: '%s'"), buf.buf);
|
return error(_("invalid orig-head: '%s'"), buf.buf);
|
||||||
|
|
||||||
strbuf_reset(&buf);
|
if (file_exists(state_dir_path("quiet", opts)))
|
||||||
if (read_one(state_dir_path("quiet", opts), &buf))
|
|
||||||
return -1;
|
|
||||||
if (buf.len)
|
|
||||||
opts->flags &= ~REBASE_NO_QUIET;
|
opts->flags &= ~REBASE_NO_QUIET;
|
||||||
else
|
else
|
||||||
opts->flags |= REBASE_NO_QUIET;
|
opts->flags |= REBASE_NO_QUIET;
|
||||||
|
@ -113,7 +113,7 @@ read_basic_state () {
|
|||||||
else
|
else
|
||||||
orig_head=$(cat "$state_dir"/head)
|
orig_head=$(cat "$state_dir"/head)
|
||||||
fi &&
|
fi &&
|
||||||
GIT_QUIET=$(cat "$state_dir"/quiet) &&
|
test -f "$state_dir"/quiet && GIT_QUIET=t
|
||||||
test -f "$state_dir"/verbose && verbose=t
|
test -f "$state_dir"/verbose && verbose=t
|
||||||
test -f "$state_dir"/strategy && strategy="$(cat "$state_dir"/strategy)"
|
test -f "$state_dir"/strategy && strategy="$(cat "$state_dir"/strategy)"
|
||||||
test -f "$state_dir"/strategy_opts &&
|
test -f "$state_dir"/strategy_opts &&
|
||||||
|
@ -10,7 +10,7 @@ write_basic_state () {
|
|||||||
echo "$head_name" > "$state_dir"/head-name &&
|
echo "$head_name" > "$state_dir"/head-name &&
|
||||||
echo "$onto" > "$state_dir"/onto &&
|
echo "$onto" > "$state_dir"/onto &&
|
||||||
echo "$orig_head" > "$state_dir"/orig-head &&
|
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 t = "$verbose" && : > "$state_dir"/verbose
|
||||||
test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
|
test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
|
||||||
test -n "$strategy_opts" && echo "$strategy_opts" > \
|
test -n "$strategy_opts" && echo "$strategy_opts" > \
|
||||||
|
13
sequencer.c
13
sequencer.c
@ -150,6 +150,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_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_orig_head, "rebase-merge/orig-head")
|
||||||
static GIT_PATH_FUNC(rebase_path_verbose, "rebase-merge/verbose")
|
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_signoff, "rebase-merge/signoff")
|
||||||
static GIT_PATH_FUNC(rebase_path_head_name, "rebase-merge/head-name")
|
static GIT_PATH_FUNC(rebase_path_head_name, "rebase-merge/head-name")
|
||||||
static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto")
|
static GIT_PATH_FUNC(rebase_path_onto, "rebase-merge/onto")
|
||||||
@ -157,7 +158,6 @@ static GIT_PATH_FUNC(rebase_path_autostash, "rebase-merge/autostash")
|
|||||||
static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy")
|
static GIT_PATH_FUNC(rebase_path_strategy, "rebase-merge/strategy")
|
||||||
static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
|
static GIT_PATH_FUNC(rebase_path_strategy_opts, "rebase-merge/strategy_opts")
|
||||||
static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, "rebase-merge/allow_rerere_autoupdate")
|
static GIT_PATH_FUNC(rebase_path_allow_rerere_autoupdate, "rebase-merge/allow_rerere_autoupdate")
|
||||||
static GIT_PATH_FUNC(rebase_path_quiet, "rebase-merge/quiet")
|
|
||||||
|
|
||||||
static int git_sequencer_config(const char *k, const char *v, void *cb)
|
static int git_sequencer_config(const char *k, const char *v, void *cb)
|
||||||
{
|
{
|
||||||
@ -2357,6 +2357,9 @@ static int read_populate_opts(struct replay_opts *opts)
|
|||||||
if (file_exists(rebase_path_verbose()))
|
if (file_exists(rebase_path_verbose()))
|
||||||
opts->verbose = 1;
|
opts->verbose = 1;
|
||||||
|
|
||||||
|
if (file_exists(rebase_path_quiet()))
|
||||||
|
opts->quiet = 1;
|
||||||
|
|
||||||
if (file_exists(rebase_path_signoff())) {
|
if (file_exists(rebase_path_signoff())) {
|
||||||
opts->allow_ff = 0;
|
opts->allow_ff = 0;
|
||||||
opts->signoff = 1;
|
opts->signoff = 1;
|
||||||
@ -2424,9 +2427,6 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,
|
|||||||
|
|
||||||
if (quiet)
|
if (quiet)
|
||||||
write_file(rebase_path_quiet(), "%s\n", quiet);
|
write_file(rebase_path_quiet(), "%s\n", quiet);
|
||||||
else
|
|
||||||
write_file(rebase_path_quiet(), "\n");
|
|
||||||
|
|
||||||
if (opts->verbose)
|
if (opts->verbose)
|
||||||
write_file(rebase_path_verbose(), "%s", "");
|
write_file(rebase_path_verbose(), "%s", "");
|
||||||
if (opts->strategy)
|
if (opts->strategy)
|
||||||
@ -3503,6 +3503,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
|
|||||||
fprintf(f, "%d\n", todo_list->done_nr);
|
fprintf(f, "%d\n", todo_list->done_nr);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
if (!opts->quiet)
|
||||||
fprintf(stderr, "Rebasing (%d/%d)%s",
|
fprintf(stderr, "Rebasing (%d/%d)%s",
|
||||||
todo_list->done_nr,
|
todo_list->done_nr,
|
||||||
todo_list->total_nr,
|
todo_list->total_nr,
|
||||||
@ -3738,7 +3739,9 @@ cleanup_head_ref:
|
|||||||
}
|
}
|
||||||
apply_autostash(opts);
|
apply_autostash(opts);
|
||||||
|
|
||||||
fprintf(stderr, "Successfully rebased and updated %s.\n",
|
if (!opts->quiet)
|
||||||
|
fprintf(stderr,
|
||||||
|
"Successfully rebased and updated %s.\n",
|
||||||
head_ref.buf);
|
head_ref.buf);
|
||||||
|
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
@ -39,6 +39,7 @@ struct replay_opts {
|
|||||||
int allow_empty_message;
|
int allow_empty_message;
|
||||||
int keep_redundant_commits;
|
int keep_redundant_commits;
|
||||||
int verbose;
|
int verbose;
|
||||||
|
int quiet;
|
||||||
|
|
||||||
int mainline;
|
int mainline;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user