diff options
author | Sergey Organov <sorganov@gmail.com> | 2020-12-21 16:19:35 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-21 22:47:30 +0100 |
commit | 7acf0d06f54043b3b79d5d388ed1c8fb66e2db5a (patch) | |
tree | 62a61608f95832357632e4b6d9bc17776ab4b684 | |
parent | diff-merges: rename all functions to have common prefix (diff) | |
download | git-7acf0d06f54043b3b79d5d388ed1c8fb66e2db5a.tar.xz git-7acf0d06f54043b3b79d5d388ed1c8fb66e2db5a.zip |
diff-merges: move checks for first_parent_only out of the module
The checks for first_parent_only don't in fact belong to this module,
as the primary purpose of this flag is history traversal limiting, so
get it out of this module and rename the
diff_merges_first_parent_defaults_to_enable()
to
diff_merges_default_to_enable()
to match new semantics.
Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/log.c | 8 | ||||
-rw-r--r-- | diff-merges.c | 10 | ||||
-rw-r--r-- | diff-merges.h | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/builtin/log.c b/builtin/log.c index 77a7bba543..a7791c003c 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -599,7 +599,10 @@ static int show_tree_object(const struct object_id *oid, static void show_setup_revisions_tweak(struct rev_info *rev, struct setup_revision_opt *opt) { - diff_merges_default_to_dense_combined(rev); + if (rev->first_parent_only) + diff_merges_default_to_enable(rev); + else + diff_merges_default_to_dense_combined(rev); if (!rev->diffopt.output_format) rev->diffopt.output_format = DIFF_FORMAT_PATCH; } @@ -724,7 +727,8 @@ static void log_setup_revisions_tweak(struct rev_info *rev, if (!rev->diffopt.output_format && rev->combine_merges) rev->diffopt.output_format = DIFF_FORMAT_PATCH; - diff_merges_first_parent_defaults_to_enable(rev); + if (rev->first_parent_only) + diff_merges_default_to_enable(rev); } int cmd_log(int argc, const char **argv, const char *prefix) diff --git a/diff-merges.c b/diff-merges.c index 9286dbbd4d..a3bafa92f3 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -56,19 +56,17 @@ void diff_merges_setup_revs(struct rev_info *revs) die("--combined-all-paths makes no sense without -c or --cc"); } -void diff_merges_first_parent_defaults_to_enable(struct rev_info *revs) +void diff_merges_default_to_enable(struct rev_info *revs) { - if (revs->first_parent_only && revs->ignore_merges < 0) + if (revs->ignore_merges < 0) /* No -m */ revs->ignore_merges = 0; } void diff_merges_default_to_dense_combined(struct rev_info *revs) { - if (revs->ignore_merges < 0) { - /* There was no "-m" variant on the command line */ + if (revs->ignore_merges < 0) { /* No -m */ revs->ignore_merges = 0; - if (!revs->first_parent_only && !revs->combine_merges) { - /* No "--first-parent", "-c", or "--cc" */ + if (!revs->combine_merges) { /* No -c/--cc" */ revs->combine_merges = 1; revs->dense_combined_merges = 1; } diff --git a/diff-merges.h b/diff-merges.h index 4ced909b79..6937d46219 100644 --- a/diff-merges.h +++ b/diff-merges.h @@ -17,7 +17,7 @@ void diff_merges_setup_revs(struct rev_info *revs); void diff_merges_default_to_dense_combined(struct rev_info *revs); -void diff_merges_first_parent_defaults_to_enable(struct rev_info *revs); +void diff_merges_default_to_enable(struct rev_info *revs); #endif |