merge: enable progress reporting for rename detection
The user can enable or disable it explicitly with the new --progress, but it defaults to checking isatty(2). This works only with merge-recursive and subtree. In theory we could pass a progress flag to other strategies, but none of them support progress at this point, so let's wait until they grow such a feature before worrying about propagating it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Feb 20, 2011 at 04:53 UTC
99bfc6691d79eaffaaf170a8b6584bcfe97863dc
4 files changed
+18
-1
Documentation/merge-options.txt
+9
-1
@@ -75,9 +75,17 @@ option can be used to override --squash.
75
ifndef::git-pull[]
76
-q::
77
--quiet::
78
- Operate quietly.
78
+ Operate quietly. Implies --no-progress.
79
80
-v::
81
--verbose::
82
Be verbose.
83
+
84
+--progress::
85
+--no-progress::
86
+ Turn progress on/off explicitly. If neither is specified,
87
+ progress is shown if standard error is connected to a terminal.
88
+ Note that not all merge strategies may support progress
89
+ reporting.
90
+
91
endif::git-pull[]
builtin/merge.c
+7
@@ -58,6 +58,7 @@ static int option_renormalize;
58
static int verbosity;
59
static int allow_rerere_auto;
60
static int abort_current_merge;
61
+static int show_progress = -1;
62
63
static struct strategy all_strategy[] = {
64
{ "recursive", DEFAULT_TWOHEAD | NO_TRIVIAL },
@@ -200,6 +201,7 @@ static struct option builtin_merge_options[] = {
201
OPT__VERBOSITY(&verbosity),
202
OPT_BOOLEAN(0, "abort", &abort_current_merge,
203
"abort the current in-progress merge"),
204
+ OPT_SET_INT(0, "progress", &show_progress, "force progress reporting", 1),
205
OPT_END()
206
};
207
@@ -659,6 +661,8 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
661
o.subtree_shift = "";
662
663
o.renormalize = option_renormalize;
664
+ o.show_rename_progress =
665
+ show_progress == -1 ? isatty(2) : show_progress;
666
667
for (x = 0; x < xopts_nr; x++)
668
if (parse_merge_opt(&o, xopts[x]))
@@ -944,6 +948,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
948
argc = parse_options(argc, argv, prefix, builtin_merge_options,
949
builtin_merge_usage, 0);
950
951
+ if (verbosity < 0 && show_progress == -1)
952
+ show_progress = 0;
953
+
954
if (abort_current_merge) {
955
int nargc = 2;
956
const char *nargv[] = {"reset", "--merge", NULL};
merge-recursive.c
+1
@@ -441,6 +441,7 @@ static struct string_list *get_renames(struct merge_options *o,
441
o->diff_rename_limit >= 0 ? o->diff_rename_limit :
442
1000;
443
opts.rename_score = o->rename_score;
444
+ opts.show_rename_progress = o->show_rename_progress;
445
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
446
if (diff_setup_done(&opts) < 0)
447
die("diff setup failed");
merge-recursive.h
+1
@@ -21,6 +21,7 @@ struct merge_options {
21
int merge_rename_limit;
22
int rename_score;
23
int needed_rename_limit;
24
+ int show_rename_progress;
25
int call_depth;
26
struct strbuf obuf;
27
struct string_list current_file_set;