while (list) {
struct commit *commit = list->item;
unsigned int flags = commit->object.flags;
-
list = list->next;
- if (flags & UNINTERESTING)
- continue;
- if (rev->prune_fn && rev->dense && !(flags & TREECHANGE)) {
- if (commit->parents && !commit->parents->next)
- continue;
- }
- n++;
+ if ((flags & TREECHANGE) && !(flags & UNINTERESTING))
+ n++;
}
return n;
}
if (commit->object.flags & (UNINTERESTING | COUNTED))
break;
- if (!revs.prune_fn || (commit->object.flags & TREECHANGE))
+ if (commit->object.flags & TREECHANGE)
nr++;
commit->object.flags |= COUNTED;
p = commit->parents;
/*
* Don't short-cut something we are not going to return!
*/
- if (revs.prune_fn && !(p->item->object.flags & TREECHANGE))
+ if (!(p->item->object.flags & TREECHANGE))
return 0;
if (DEBUG_BISECT)
return 0;
int distance;
unsigned flags = p->item->object.flags;
- if (revs.prune_fn && !(flags & TREECHANGE))
+ if (!(flags & TREECHANGE))
continue;
distance = weight(p);
if (nr - distance < distance)
int distance;
unsigned flags = p->item->object.flags;
- if (revs.prune_fn && !(flags & TREECHANGE))
+ if (!(flags & TREECHANGE))
continue;
distance = weight(p);
if (nr - distance < distance)
p->item->util = &weights[n++];
switch (count_interesting_parents(commit)) {
case 0:
- if (!revs.prune_fn || (flags & TREECHANGE)) {
+ if (flags & TREECHANGE) {
weight_set(p, 1);
counted++;
show_list("bisection 2 count one",
* add one for p itself if p is to be counted,
* otherwise inherit it from q directly.
*/
- if (!revs.prune_fn || (flags & TREECHANGE)) {
+ if (flags & TREECHANGE) {
weight_set(p, weight(q)+1);
counted++;
show_list("bisection 2 count one",
continue;
p->next = last;
last = p;
- if (!revs.prune_fn || (flags & TREECHANGE))
+ if (flags & TREECHANGE)
nr++;
on_list++;
}
extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
extern int rerere(void);
+static inline int single_parent(struct commit *commit)
+{
+ return commit->parents && !commit->parents->next;
+}
+
#endif /* COMMIT_H */
struct commit_list **pp, *parent;
int tree_changed = 0, tree_same = 0;
+ /*
+ * If we don't do pruning, everything is interesting
+ */
+ if (!revs->prune) {
+ commit->object.flags |= TREECHANGE;
+ return;
+ }
+
if (!commit->tree)
return;
return;
}
+ /*
+ * Normal non-merge commit? If we don't want to make the
+ * history dense, we consider it always to be a change..
+ */
+ if (!revs->dense && !commit->parents->next) {
+ commit->object.flags |= TREECHANGE;
+ return;
+ }
+
pp = &commit->parents;
while ((parent = *pp) != NULL) {
struct commit *p = parent->item;
* simplify the commit history and find the parent
* that has no differences in the path set if one exists.
*/
- if (revs->prune_fn)
- revs->prune_fn(revs, commit);
+ try_to_simplify_commit(revs, commit);
if (revs->no_walk)
return 0;
revs->skip_count = -1;
revs->max_count = -1;
- revs->prune_fn = NULL;
- revs->prune_data = NULL;
-
revs->commit_format = CMIT_FMT_DEFAULT;
diff_setup(&revs->diffopt);
diff_tree_setup_paths(revs->prune_data, &revs->pruning);
/* Can't prune commits with rename following: the paths change.. */
if (!revs->diffopt.follow_renames)
- revs->prune_fn = try_to_simplify_commit;
+ revs->prune = 1;
if (!revs->full_diff)
diff_tree_setup_paths(revs->prune_data, &revs->diffopt);
}
return commit_ignore;
if (!commit_match(commit, revs))
return commit_ignore;
- if (revs->prune_fn && revs->dense) {
+ if (revs->prune && revs->dense) {
/* Commit without changes? */
if (!(commit->object.flags & TREECHANGE)) {
/* drop merges unless we want parenthood */
struct rev_info;
struct log_info;
-typedef void (prune_fn_t)(struct rev_info *revs, struct commit *commit);
-
struct rev_info {
/* Starting list */
struct commit_list *commits;
/* Basic information */
const char *prefix;
void *prune_data;
- prune_fn_t *prune_fn;
-
unsigned int early_output;
/* Traversal flags */
unsigned int dense:1,
+ prune:1,
no_merges:1,
no_walk:1,
remove_empty_trees:1,