Skip to content

Commit e465444

Browse files
committed
Merge branch 'so/log-tree-diff-cleanup'
Code cleanup. * so/log-tree-diff-cleanup: log_tree_diff: get rid of extra check for NULL log_tree_diff: get rid of code duplication for first_parent_only
2 parents 2496da4 + 793d37c commit e465444

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

log-tree.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -917,26 +917,15 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
917917
}
918918

919919
/* More than one parent? */
920-
if (parents && parents->next) {
920+
if (parents->next) {
921921
if (opt->ignore_merges)
922922
return 0;
923923
else if (opt->combine_merges)
924924
return do_diff_combined(opt, commit);
925-
else if (opt->first_parent_only) {
926-
/*
927-
* Generate merge log entry only for the first
928-
* parent, showing summary diff of the others
929-
* we merged _in_.
930-
*/
931-
parse_commit_or_die(parents->item);
932-
diff_tree_oid(get_commit_tree_oid(parents->item),
933-
oid, "", &opt->diffopt);
934-
log_tree_diff_flush(opt);
935-
return !opt->loginfo;
925+
else if (!opt->first_parent_only) {
926+
/* If we show multiple diffs, show the parent info */
927+
log->parent = parents->item;
936928
}
937-
938-
/* If we show individual diffs, show the parent info */
939-
log->parent = parents->item;
940929
}
941930

942931
showed_log = 0;
@@ -952,7 +941,7 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
952941

953942
/* Set up the log info for the next parent, if any.. */
954943
parents = parents->next;
955-
if (!parents)
944+
if (!parents || opt->first_parent_only)
956945
break;
957946
log->parent = parents->item;
958947
opt->loginfo = log;

0 commit comments

Comments
 (0)