Skip to content

Commit

Permalink
diff-merges: introduce revs->first_parent_merges flag
Browse files Browse the repository at this point in the history
This new field allows us to separate format of diff for merges from
'first_parent_only' flag which primary purpose is limiting history
traversal.

This change further localizes diff format selection logic into the
diff-merges.c file.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
sorganov authored and gitster committed Dec 21, 2020
1 parent 3b6c17b commit 3291eea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions diff-merges.c
Expand Up @@ -73,6 +73,8 @@ 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" */
revs->first_parent_merges = 1;
}

void diff_merges_default_to_dense_combined(struct rev_info *revs)
Expand Down
4 changes: 2 additions & 2 deletions log-tree.c
Expand Up @@ -922,7 +922,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
return 0;
else if (opt->combine_merges)
return do_diff_combined(opt, commit);
else if (!opt->first_parent_only) {
else if (!opt->first_parent_merges) {
/* If we show multiple diffs, show the parent info */
log->parent = parents->item;
}
Expand All @@ -941,7 +941,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log

/* Set up the log info for the next parent, if any.. */
parents = parents->next;
if (!parents || opt->first_parent_only)
if (!parents || opt->first_parent_merges)
break;
log->parent = parents->item;
opt->loginfo = log;
Expand Down
1 change: 1 addition & 0 deletions revision.h
Expand Up @@ -194,6 +194,7 @@ struct rev_info {
combine_merges:1,
combined_all_paths:1,
dense_combined_merges:1,
first_parent_merges:1,
always_show_header:1;
int ignore_merges:2;

Expand Down

0 comments on commit 3291eea

Please sign in to comment.