summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/log.c13
-rw-r--r--revision.c19
-rw-r--r--revision.h3
3 files changed, 24 insertions, 11 deletions
diff --git a/builtin/log.c b/builtin/log.c
index 0a7ed4bef9..717855a49e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -598,15 +598,7 @@ 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)
{
- if (rev->ignore_merges < 0) {
- /* There was no "-m" variant on the command line */
- rev->ignore_merges = 0;
- if (!rev->first_parent_only && !rev->combine_merges) {
- /* No "--first-parent", "-c", or "--cc" */
- rev->combine_merges = 1;
- rev->dense_combined_merges = 1;
- }
- }
+ rev_diff_merges_default_to_dense_combined(rev);
if (!rev->diffopt.output_format)
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
}
@@ -731,8 +723,7 @@ 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;
- if (rev->first_parent_only && rev->ignore_merges < 0)
- rev->ignore_merges = 0;
+ rev_diff_merges_first_parent_defaults_to_enable(rev);
}
int cmd_log(int argc, const char **argv, const char *prefix)
diff --git a/revision.c b/revision.c
index 3250b2d7e1..1c224d2764 100644
--- a/revision.c
+++ b/revision.c
@@ -2209,6 +2209,25 @@ static void setup_diff_merges_revs(struct rev_info *revs)
die("--combined-all-paths makes no sense without -c or --cc");
}
+void rev_diff_merges_first_parent_defaults_to_enable(struct rev_info *revs)
+{
+ if (revs->first_parent_only && revs->ignore_merges < 0)
+ revs->ignore_merges = 0;
+}
+
+void rev_diff_merges_default_to_dense_combined(struct rev_info *revs)
+{
+ if (revs->ignore_merges < 0) {
+ /* There was no "-m" variant on the command line */
+ revs->ignore_merges = 0;
+ if (!revs->first_parent_only && !revs->combine_merges) {
+ /* No "--first-parent", "-c", or "--cc" */
+ revs->combine_merges = 1;
+ revs->dense_combined_merges = 1;
+ }
+ }
+}
+
static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
int *unkc, const char **unkv,
const struct setup_revision_opt* opt)
diff --git a/revision.h b/revision.h
index f6bf860d19..3dd0229f4e 100644
--- a/revision.h
+++ b/revision.h
@@ -456,4 +456,7 @@ int rewrite_parents(struct rev_info *revs,
*/
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
+void rev_diff_merges_default_to_dense_combined(struct rev_info *revs);
+void rev_diff_merges_first_parent_defaults_to_enable(struct rev_info *revs);
+
#endif