summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/revision.c b/revision.c
index 0b5c723140..b78733f508 100644
--- a/revision.c
+++ b/revision.c
@@ -5,6 +5,7 @@
#include "tree.h"
#include "commit.h"
#include "diff.h"
+#include "diff-merges.h"
#include "refs.h"
#include "revision.h"
#include "repository.h"
@@ -1808,7 +1809,6 @@ void repo_init_revisions(struct repository *r,
revs->repo = r;
revs->abbrev = DEFAULT_ABBREV;
- revs->ignore_merges = -1;
revs->simplify_history = 1;
revs->pruning.repo = r;
revs->pruning.flags.recursive = 1;
@@ -2343,34 +2343,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->diff = 1;
revs->diffopt.flags.recursive = 1;
revs->diffopt.flags.tree_in_recursive = 1;
- } else if (!strcmp(arg, "-m")) {
- /*
- * To "diff-index", "-m" means "match missing", and to the "log"
- * family of commands, it means "show full diff for merges". Set
- * both fields appropriately.
- */
- revs->ignore_merges = 0;
- revs->match_missing = 1;
- } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
- if (!strcmp(optarg, "off")) {
- revs->ignore_merges = 1;
- } else {
- die(_("unknown value for --diff-merges: %s"), optarg);
- }
+ } else if ((argcount = diff_merges_parse_opts(revs, argv))) {
return argcount;
- } else if (!strcmp(arg, "--no-diff-merges")) {
- revs->ignore_merges = 1;
- } else if (!strcmp(arg, "-c")) {
- revs->diff = 1;
- revs->dense_combined_merges = 0;
- revs->combine_merges = 1;
- } else if (!strcmp(arg, "--combined-all-paths")) {
- revs->diff = 1;
- revs->combined_all_paths = 1;
- } else if (!strcmp(arg, "--cc")) {
- revs->diff = 1;
- revs->dense_combined_merges = 1;
- revs->combine_merges = 1;
} else if (!strcmp(arg, "-v")) {
revs->verbose_header = 1;
} else if (!strcmp(arg, "--pretty")) {
@@ -2491,8 +2465,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
} else if ((argcount = parse_long_opt("grep", argv, &optarg))) {
add_message_grep(revs, optarg);
return argcount;
- } else if (!strcmp(arg, "--grep-debug")) {
- revs->grep_filter.debug = 1;
} else if (!strcmp(arg, "--basic-regexp")) {
revs->grep_filter.pattern_type_option = GREP_PATTERN_TYPE_BRE;
} else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {
@@ -2867,12 +2839,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
copy_pathspec(&revs->diffopt.pathspec,
&revs->prune_data);
}
- if (revs->combine_merges && revs->ignore_merges < 0)
- revs->ignore_merges = 0;
- if (revs->ignore_merges < 0)
- revs->ignore_merges = 1;
- if (revs->combined_all_paths && !revs->combine_merges)
- die("--combined-all-paths makes no sense without -c or --cc");
+
+ diff_merges_setup_revs(revs);
revs->diffopt.abbrev = revs->abbrev;
@@ -3302,7 +3270,7 @@ define_commit_slab(indegree_slab, int);
define_commit_slab(author_date_slab, timestamp_t);
struct topo_walk_info {
- uint32_t min_generation;
+ timestamp_t min_generation;
struct prio_queue explore_queue;
struct prio_queue indegree_queue;
struct prio_queue topo_queue;
@@ -3370,7 +3338,7 @@ static void explore_walk_step(struct rev_info *revs)
}
static void explore_to_depth(struct rev_info *revs,
- uint32_t gen_cutoff)
+ timestamp_t gen_cutoff)
{
struct topo_walk_info *info = revs->topo_walk_info;
struct commit *c;
@@ -3399,6 +3367,9 @@ static void indegree_walk_step(struct rev_info *revs)
struct commit *parent = p->item;
int *pi = indegree_slab_at(&info->indegree, parent);
+ if (repo_parse_commit_gently(revs->repo, parent, 1) < 0)
+ return;
+
if (*pi)
(*pi)++;
else
@@ -3412,7 +3383,7 @@ static void indegree_walk_step(struct rev_info *revs)
}
static void compute_indegrees_to_depth(struct rev_info *revs,
- uint32_t gen_cutoff)
+ timestamp_t gen_cutoff)
{
struct topo_walk_info *info = revs->topo_walk_info;
struct commit *c;
@@ -3470,7 +3441,7 @@ static void init_topo_walk(struct rev_info *revs)
info->min_generation = GENERATION_NUMBER_INFINITY;
for (list = revs->commits; list; list = list->next) {
struct commit *c = list->item;
- uint32_t generation;
+ timestamp_t generation;
if (repo_parse_commit_gently(revs->repo, c, 1))
continue;
@@ -3538,7 +3509,7 @@ static void expand_topo_walk(struct rev_info *revs, struct commit *commit)
for (p = commit->parents; p; p = p->next) {
struct commit *parent = p->item;
int *pi;
- uint32_t generation;
+ timestamp_t generation;
if (parent->object.flags & UNINTERESTING)
continue;