log_tree_diff: get rid of code duplication for first_parent_only
Handle first_parent_only by breaking from generic loop early rather than by duplicating (part of) the loop body. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
3a238e539b
commit
a7b9430940
19
log-tree.c
19
log-tree.c
|
@ -922,21 +922,10 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
|
||||||
return 0;
|
return 0;
|
||||||
else if (opt->combine_merges)
|
else if (opt->combine_merges)
|
||||||
return do_diff_combined(opt, commit);
|
return do_diff_combined(opt, commit);
|
||||||
else if (opt->first_parent_only) {
|
else if (!opt->first_parent_only) {
|
||||||
/*
|
/* If we show multiple diffs, show the parent info */
|
||||||
* Generate merge log entry only for the first
|
log->parent = parents->item;
|
||||||
* parent, showing summary diff of the others
|
|
||||||
* we merged _in_.
|
|
||||||
*/
|
|
||||||
parse_commit_or_die(parents->item);
|
|
||||||
diff_tree_oid(get_commit_tree_oid(parents->item),
|
|
||||||
oid, "", &opt->diffopt);
|
|
||||||
log_tree_diff_flush(opt);
|
|
||||||
return !opt->loginfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we show individual diffs, show the parent info */
|
|
||||||
log->parent = parents->item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showed_log = 0;
|
showed_log = 0;
|
||||||
|
@ -952,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.. */
|
/* Set up the log info for the next parent, if any.. */
|
||||||
parents = parents->next;
|
parents = parents->next;
|
||||||
if (!parents)
|
if (!parents || opt->first_parent_only)
|
||||||
break;
|
break;
|
||||||
log->parent = parents->item;
|
log->parent = parents->item;
|
||||||
opt->loginfo = log;
|
opt->loginfo = log;
|
||||||
|
|
Loading…
Reference in New Issue