revision walker: mini clean-up
This removes the unnecessary indirection of "revs->prune_fn", since that function is always the same one (or NULL), and there is in fact not even an abstraction reason to make it a function (i.e. its not called from some other file and doesn't allow us to keep the function itself static or anything like that). It then just replaces it with a bit that says "prune or not", and if not pruning, every commit gets TREECHANGE. That in turn means that - if (!revs->prune_fn || (flags & TREECHANGE)) - if (revs->prune_fn && !(flags & TREECHANGE)) just become - if (flags & TREECHANGE) - if (!(flags & TREECHANGE)) respectively. Together with adding the "single_parent()" helper function, the "complex" conditional now becomes if (!(flags & TREECHANGE) && rev->dense && single_parent(commit)) continue; Also indirection of "revs->dense" checking is thrown away the same way, because TREECHANGE bit is set appropriately now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
252a7c0235
commit
53b2c823f6
@ -88,15 +88,9 @@ static int estimate_commit_count(struct rev_info *rev, struct commit_list *list)
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user