mirror of
https://github.com/git/git.git
synced 2024-05-28 13:56:16 +02:00
Merge branch 'jk/merge-rename-ux'
* jk/merge-rename-ux: pull: propagate --progress to merge merge: enable progress reporting for rename detection add inexact rename detection progress infrastructure commit: stop setting rename limit bump rename limit defaults (again) merge: improve inexact rename limit warning
This commit is contained in:
commit
0ce6a51b43
|
@ -75,9 +75,17 @@ option can be used to override --squash.
|
||||||
ifndef::git-pull[]
|
ifndef::git-pull[]
|
||||||
-q::
|
-q::
|
||||||
--quiet::
|
--quiet::
|
||||||
Operate quietly.
|
Operate quietly. Implies --no-progress.
|
||||||
|
|
||||||
-v::
|
-v::
|
||||||
--verbose::
|
--verbose::
|
||||||
Be verbose.
|
Be verbose.
|
||||||
|
|
||||||
|
--progress::
|
||||||
|
--no-progress::
|
||||||
|
Turn progress on/off explicitly. If neither is specified,
|
||||||
|
progress is shown if standard error is connected to a terminal.
|
||||||
|
Note that not all merge strategies may support progress
|
||||||
|
reporting.
|
||||||
|
|
||||||
endif::git-pull[]
|
endif::git-pull[]
|
||||||
|
|
|
@ -1285,7 +1285,6 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
|
||||||
get_commit_format(format.buf, &rev);
|
get_commit_format(format.buf, &rev);
|
||||||
rev.always_show_header = 0;
|
rev.always_show_header = 0;
|
||||||
rev.diffopt.detect_rename = 1;
|
rev.diffopt.detect_rename = 1;
|
||||||
rev.diffopt.rename_limit = 100;
|
|
||||||
rev.diffopt.break_opt = 0;
|
rev.diffopt.break_opt = 0;
|
||||||
diff_setup_done(&rev.diffopt);
|
diff_setup_done(&rev.diffopt);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ static int option_renormalize;
|
||||||
static int verbosity;
|
static int verbosity;
|
||||||
static int allow_rerere_auto;
|
static int allow_rerere_auto;
|
||||||
static int abort_current_merge;
|
static int abort_current_merge;
|
||||||
|
static int show_progress = -1;
|
||||||
|
|
||||||
static struct strategy all_strategy[] = {
|
static struct strategy all_strategy[] = {
|
||||||
{ "recursive", DEFAULT_TWOHEAD | NO_TRIVIAL },
|
{ "recursive", DEFAULT_TWOHEAD | NO_TRIVIAL },
|
||||||
|
@ -200,6 +201,7 @@ static struct option builtin_merge_options[] = {
|
||||||
OPT__VERBOSITY(&verbosity),
|
OPT__VERBOSITY(&verbosity),
|
||||||
OPT_BOOLEAN(0, "abort", &abort_current_merge,
|
OPT_BOOLEAN(0, "abort", &abort_current_merge,
|
||||||
"abort the current in-progress merge"),
|
"abort the current in-progress merge"),
|
||||||
|
OPT_SET_INT(0, "progress", &show_progress, "force progress reporting", 1),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -660,6 +662,8 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
|
||||||
o.subtree_shift = "";
|
o.subtree_shift = "";
|
||||||
|
|
||||||
o.renormalize = option_renormalize;
|
o.renormalize = option_renormalize;
|
||||||
|
o.show_rename_progress =
|
||||||
|
show_progress == -1 ? isatty(2) : show_progress;
|
||||||
|
|
||||||
for (x = 0; x < xopts_nr; x++)
|
for (x = 0; x < xopts_nr; x++)
|
||||||
if (parse_merge_opt(&o, xopts[x]))
|
if (parse_merge_opt(&o, xopts[x]))
|
||||||
|
@ -974,6 +978,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||||
argc = parse_options(argc, argv, prefix, builtin_merge_options,
|
argc = parse_options(argc, argv, prefix, builtin_merge_options,
|
||||||
builtin_merge_usage, 0);
|
builtin_merge_usage, 0);
|
||||||
|
|
||||||
|
if (verbosity < 0 && show_progress == -1)
|
||||||
|
show_progress = 0;
|
||||||
|
|
||||||
if (abort_current_merge) {
|
if (abort_current_merge) {
|
||||||
int nargc = 2;
|
int nargc = 2;
|
||||||
const char *nargv[] = {"reset", "--merge", NULL};
|
const char *nargv[] = {"reset", "--merge", NULL};
|
||||||
|
|
2
diff.c
2
diff.c
|
@ -23,7 +23,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int diff_detect_rename_default;
|
static int diff_detect_rename_default;
|
||||||
static int diff_rename_limit_default = 200;
|
static int diff_rename_limit_default = 400;
|
||||||
static int diff_suppress_blank_empty;
|
static int diff_suppress_blank_empty;
|
||||||
int diff_use_color_default = -1;
|
int diff_use_color_default = -1;
|
||||||
static const char *diff_word_regex_cfg;
|
static const char *diff_word_regex_cfg;
|
||||||
|
|
3
diff.h
3
diff.h
|
@ -110,7 +110,8 @@ struct diff_options {
|
||||||
int pickaxe_opts;
|
int pickaxe_opts;
|
||||||
int rename_score;
|
int rename_score;
|
||||||
int rename_limit;
|
int rename_limit;
|
||||||
int warn_on_too_large_rename;
|
int needed_rename_limit;
|
||||||
|
int show_rename_progress;
|
||||||
int dirstat_percent;
|
int dirstat_percent;
|
||||||
int setup;
|
int setup;
|
||||||
int abbrev;
|
int abbrev;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "diff.h"
|
#include "diff.h"
|
||||||
#include "diffcore.h"
|
#include "diffcore.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
#include "progress.h"
|
||||||
|
|
||||||
/* Table of rename/copy destinations */
|
/* Table of rename/copy destinations */
|
||||||
|
|
||||||
|
@ -449,6 +450,7 @@ void diffcore_rename(struct diff_options *options)
|
||||||
struct diff_score *mx;
|
struct diff_score *mx;
|
||||||
int i, j, rename_count;
|
int i, j, rename_count;
|
||||||
int num_create, num_src, dst_cnt;
|
int num_create, num_src, dst_cnt;
|
||||||
|
struct progress *progress = NULL;
|
||||||
|
|
||||||
if (!minimum_score)
|
if (!minimum_score)
|
||||||
minimum_score = DEFAULT_RENAME_SCORE;
|
minimum_score = DEFAULT_RENAME_SCORE;
|
||||||
|
@ -518,15 +520,22 @@ void diffcore_rename(struct diff_options *options)
|
||||||
* but handles the potential overflow case specially (and we
|
* but handles the potential overflow case specially (and we
|
||||||
* assume at least 32-bit integers)
|
* assume at least 32-bit integers)
|
||||||
*/
|
*/
|
||||||
|
options->needed_rename_limit = 0;
|
||||||
if (rename_limit <= 0 || rename_limit > 32767)
|
if (rename_limit <= 0 || rename_limit > 32767)
|
||||||
rename_limit = 32767;
|
rename_limit = 32767;
|
||||||
if ((num_create > rename_limit && num_src > rename_limit) ||
|
if ((num_create > rename_limit && num_src > rename_limit) ||
|
||||||
(num_create * num_src > rename_limit * rename_limit)) {
|
(num_create * num_src > rename_limit * rename_limit)) {
|
||||||
if (options->warn_on_too_large_rename)
|
options->needed_rename_limit =
|
||||||
warning("too many files (created: %d deleted: %d), skipping inexact rename detection", num_create, num_src);
|
num_src > num_create ? num_src : num_create;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options->show_rename_progress) {
|
||||||
|
progress = start_progress_delay(
|
||||||
|
"Performing inexact rename detection",
|
||||||
|
rename_dst_nr * rename_src_nr, 50, 1);
|
||||||
|
}
|
||||||
|
|
||||||
mx = xcalloc(num_create * NUM_CANDIDATE_PER_DST, sizeof(*mx));
|
mx = xcalloc(num_create * NUM_CANDIDATE_PER_DST, sizeof(*mx));
|
||||||
for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
|
for (dst_cnt = i = 0; i < rename_dst_nr; i++) {
|
||||||
struct diff_filespec *two = rename_dst[i].two;
|
struct diff_filespec *two = rename_dst[i].two;
|
||||||
|
@ -556,7 +565,9 @@ void diffcore_rename(struct diff_options *options)
|
||||||
diff_free_filespec_blob(two);
|
diff_free_filespec_blob(two);
|
||||||
}
|
}
|
||||||
dst_cnt++;
|
dst_cnt++;
|
||||||
|
display_progress(progress, (i+1)*rename_src_nr);
|
||||||
}
|
}
|
||||||
|
stop_progress(&progress);
|
||||||
|
|
||||||
/* cost matrix sorted by most to least similar pair */
|
/* cost matrix sorted by most to least similar pair */
|
||||||
qsort(mx, dst_cnt * NUM_CANDIDATE_PER_DST, sizeof(*mx), score_compare);
|
qsort(mx, dst_cnt * NUM_CANDIDATE_PER_DST, sizeof(*mx), score_compare);
|
||||||
|
|
|
@ -53,6 +53,8 @@ do
|
||||||
verbosity="$verbosity -v" ;;
|
verbosity="$verbosity -v" ;;
|
||||||
--progress)
|
--progress)
|
||||||
progress=--progress ;;
|
progress=--progress ;;
|
||||||
|
--no-progress)
|
||||||
|
progress=--no-progress ;;
|
||||||
-n|--no-stat|--no-summary)
|
-n|--no-stat|--no-summary)
|
||||||
diffstat=--no-stat ;;
|
diffstat=--no-stat ;;
|
||||||
--stat|--summary)
|
--stat|--summary)
|
||||||
|
@ -293,8 +295,8 @@ true)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
eval="git-merge $diffstat $no_commit $squash $no_ff $ff_only"
|
eval="git-merge $diffstat $no_commit $squash $no_ff $ff_only"
|
||||||
eval="$eval $log_arg $strategy_args $merge_args"
|
eval="$eval $log_arg $strategy_args $merge_args $verbosity $progress"
|
||||||
eval="$eval \"\$merge_name\" HEAD $merge_head $verbosity"
|
eval="$eval \"\$merge_name\" HEAD $merge_head"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
eval "exec $eval"
|
eval "exec $eval"
|
||||||
|
|
|
@ -22,6 +22,11 @@
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "submodule.h"
|
#include "submodule.h"
|
||||||
|
|
||||||
|
static const char rename_limit_advice[] =
|
||||||
|
"inexact rename detection was skipped because there were too many\n"
|
||||||
|
" files. You may want to set your merge.renamelimit variable to at least\n"
|
||||||
|
" %d and retry this merge.";
|
||||||
|
|
||||||
static struct tree *shift_tree_object(struct tree *one, struct tree *two,
|
static struct tree *shift_tree_object(struct tree *one, struct tree *two,
|
||||||
const char *subtree_shift)
|
const char *subtree_shift)
|
||||||
{
|
{
|
||||||
|
@ -418,14 +423,16 @@ static struct string_list *get_renames(struct merge_options *o,
|
||||||
opts.detect_rename = DIFF_DETECT_RENAME;
|
opts.detect_rename = DIFF_DETECT_RENAME;
|
||||||
opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
|
opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
|
||||||
o->diff_rename_limit >= 0 ? o->diff_rename_limit :
|
o->diff_rename_limit >= 0 ? o->diff_rename_limit :
|
||||||
500;
|
1000;
|
||||||
opts.rename_score = o->rename_score;
|
opts.rename_score = o->rename_score;
|
||||||
opts.warn_on_too_large_rename = 1;
|
opts.show_rename_progress = o->show_rename_progress;
|
||||||
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||||
if (diff_setup_done(&opts) < 0)
|
if (diff_setup_done(&opts) < 0)
|
||||||
die("diff setup failed");
|
die("diff setup failed");
|
||||||
diff_tree_sha1(o_tree->object.sha1, tree->object.sha1, "", &opts);
|
diff_tree_sha1(o_tree->object.sha1, tree->object.sha1, "", &opts);
|
||||||
diffcore_std(&opts);
|
diffcore_std(&opts);
|
||||||
|
if (opts.needed_rename_limit > o->needed_rename_limit)
|
||||||
|
o->needed_rename_limit = opts.needed_rename_limit;
|
||||||
for (i = 0; i < diff_queued_diff.nr; ++i) {
|
for (i = 0; i < diff_queued_diff.nr; ++i) {
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
struct rename *re;
|
struct rename *re;
|
||||||
|
@ -1649,6 +1656,8 @@ int merge_recursive(struct merge_options *o,
|
||||||
commit_list_insert(h2, &(*result)->parents->next);
|
commit_list_insert(h2, &(*result)->parents->next);
|
||||||
}
|
}
|
||||||
flush_output(o);
|
flush_output(o);
|
||||||
|
if (o->needed_rename_limit)
|
||||||
|
warning(rename_limit_advice, o->needed_rename_limit);
|
||||||
return clean;
|
return clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ struct merge_options {
|
||||||
int diff_rename_limit;
|
int diff_rename_limit;
|
||||||
int merge_rename_limit;
|
int merge_rename_limit;
|
||||||
int rename_score;
|
int rename_score;
|
||||||
|
int needed_rename_limit;
|
||||||
|
int show_rename_progress;
|
||||||
int call_depth;
|
int call_depth;
|
||||||
struct strbuf obuf;
|
struct strbuf obuf;
|
||||||
struct string_list current_file_set;
|
struct string_list current_file_set;
|
||||||
|
|
Loading…
Reference in New Issue