зеркало из https://github.com/microsoft/git.git
diff-merges: split 'ignore_merges' field
'ignore_merges' was 3-way field that served two distinct purposes that we now assign to 2 new independent flags: 'separate_merges', and 'explicit_diff_merges'. 'separate_merges' tells that we need to output diff format containing separate diff for every parent (as opposed to 'combine_merges'). 'explicit_diff_merges' tells that at least one of diff-merges options has been explicitly specified on the command line, so no defaults should apply. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
6fc944d895
Коммит
1a2c4d8050
|
@ -4,7 +4,7 @@
|
|||
|
||||
static void suppress(struct rev_info *revs)
|
||||
{
|
||||
revs->ignore_merges = 1;
|
||||
revs->separate_merges = 0;
|
||||
revs->first_parent_merges = 0;
|
||||
revs->combine_merges = 0;
|
||||
revs->dense_combined_merges = 0;
|
||||
|
@ -23,7 +23,6 @@ static void set_dense_combined(struct rev_info *revs)
|
|||
|
||||
void diff_merges_init_revs(struct rev_info *revs)
|
||||
{
|
||||
revs->ignore_merges = -1;
|
||||
}
|
||||
|
||||
int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
||||
|
@ -39,7 +38,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
|||
* family of commands, it means "show full diff for merges". Set
|
||||
* both fields appropriately.
|
||||
*/
|
||||
revs->ignore_merges = 0;
|
||||
revs->separate_merges = 1;
|
||||
revs->match_missing = 1;
|
||||
} else if (!strcmp(arg, "-c")) {
|
||||
revs->dense_combined_merges = 0;
|
||||
|
@ -57,8 +56,9 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
|||
die(_("unknown value for --diff-merges: %s"), optarg);
|
||||
}
|
||||
} else
|
||||
argcount = 0;
|
||||
return 0;
|
||||
|
||||
revs->explicit_diff_merges = 1;
|
||||
return argcount;
|
||||
}
|
||||
|
||||
|
@ -69,21 +69,16 @@ void diff_merges_suppress(struct rev_info *revs)
|
|||
|
||||
void diff_merges_default_to_first_parent(struct rev_info *revs)
|
||||
{
|
||||
if (revs->ignore_merges < 0) /* No -m */
|
||||
revs->ignore_merges = 0;
|
||||
if (!revs->combine_merges) /* No -c/--cc" */
|
||||
if (!revs->explicit_diff_merges)
|
||||
revs->separate_merges = 1;
|
||||
if (revs->separate_merges)
|
||||
revs->first_parent_merges = 1;
|
||||
}
|
||||
|
||||
void diff_merges_default_to_dense_combined(struct rev_info *revs)
|
||||
{
|
||||
if (revs->ignore_merges < 0) { /* No -m */
|
||||
revs->ignore_merges = 0;
|
||||
if (!revs->combine_merges) { /* No -c/--cc" */
|
||||
revs->combine_merges = 1;
|
||||
revs->dense_combined_merges = 1;
|
||||
}
|
||||
}
|
||||
if (!revs->explicit_diff_merges)
|
||||
set_dense_combined(revs);
|
||||
}
|
||||
|
||||
void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)
|
||||
|
@ -94,10 +89,10 @@ void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)
|
|||
|
||||
void diff_merges_setup_revs(struct rev_info *revs)
|
||||
{
|
||||
if (revs->combine_merges && revs->ignore_merges < 0)
|
||||
revs->ignore_merges = 0;
|
||||
if (revs->ignore_merges < 0)
|
||||
revs->ignore_merges = 1;
|
||||
if (revs->combine_merges == 0)
|
||||
revs->dense_combined_merges = 0;
|
||||
if (revs->separate_merges == 0)
|
||||
revs->first_parent_merges = 0;
|
||||
if (revs->combined_all_paths && !revs->combine_merges)
|
||||
die("--combined-all-paths makes no sense without -c or --cc");
|
||||
if (revs->combine_merges) {
|
||||
|
|
15
log-tree.c
15
log-tree.c
|
@ -918,14 +918,15 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
|
|||
|
||||
/* More than one parent? */
|
||||
if (parents->next) {
|
||||
if (opt->ignore_merges)
|
||||
return 0;
|
||||
else if (opt->combine_merges)
|
||||
if (opt->combine_merges)
|
||||
return do_diff_combined(opt, commit);
|
||||
else if (!opt->first_parent_merges) {
|
||||
/* If we show multiple diffs, show the parent info */
|
||||
log->parent = parents->item;
|
||||
}
|
||||
if (opt->separate_merges) {
|
||||
if (!opt->first_parent_merges) {
|
||||
/* Show parent info for multiple diffs */
|
||||
log->parent = parents->item;
|
||||
}
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
showed_log = 0;
|
||||
|
|
|
@ -191,12 +191,13 @@ struct rev_info {
|
|||
match_missing:1,
|
||||
no_commit_id:1,
|
||||
verbose_header:1,
|
||||
explicit_diff_merges: 1,
|
||||
separate_merges: 1,
|
||||
combine_merges:1,
|
||||
combined_all_paths:1,
|
||||
dense_combined_merges:1,
|
||||
first_parent_merges:1,
|
||||
always_show_header:1;
|
||||
int ignore_merges:2;
|
||||
|
||||
/* Format info */
|
||||
int show_notes;
|
||||
|
|
Загрузка…
Ссылка в новой задаче