diff options
-rw-r--r-- | revision.c | 4 | ||||
-rw-r--r-- | revision.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/revision.c b/revision.c index bf58448367..a31434bdc8 100644 --- a/revision.c +++ b/revision.c @@ -1077,6 +1077,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->show_all = 1; } else if (!strcmp(arg, "--remove-empty")) { revs->remove_empty_trees = 1; + } else if (!strcmp(arg, "--merges")) { + revs->merges_only = 1; } else if (!strcmp(arg, "--no-merges")) { revs->no_merges = 1; } else if (!strcmp(arg, "--boundary")) { @@ -1676,6 +1678,8 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit) return commit_ignore; if (revs->no_merges && commit->parents && commit->parents->next) return commit_ignore; + if (revs->merges_only && !(commit->parents && commit->parents->next)) + return commit_ignore; if (!commit_match(commit, revs)) return commit_ignore; if (revs->prune && revs->dense) { diff --git a/revision.h b/revision.h index 227164cf70..fb74492714 100644 --- a/revision.h +++ b/revision.h @@ -36,6 +36,7 @@ struct rev_info { unsigned int dense:1, prune:1, no_merges:1, + merges_only:1, no_walk:1, show_all:1, remove_empty_trees:1, |