summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 872d001)
raw | patch | inline | side by side (parent: 872d001)
author | Linus Torvalds <torvalds@osdl.org> | |
Sun, 5 Mar 2006 17:53:52 +0000 (09:53 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 5 Mar 2006 21:35:41 +0000 (13:35 -0800) |
This resurrects the special casing for "rev-list -n 1" which
avoided reading parents unnecessarily.
Signed-off-by: Junio C Hamano <junkio@cox.net>
avoided reading parents unnecessarily.
Signed-off-by: Junio C Hamano <junkio@cox.net>
revision.c | patch | blob | history |
diff --git a/revision.c b/revision.c
index a3df8100763136e8936b8e3b4c647d5b83cc7239..2a33637f62878f225c4eb74fbbd2ed5272cc36bb 100644 (file)
--- a/revision.c
+++ b/revision.c
struct commit *get_revision(struct rev_info *revs)
{
struct commit_list *list = revs->commits;
- struct commit *commit;
if (!list)
return NULL;
/* Check the max_count ... */
- commit = list->item;
switch (revs->max_count) {
case -1:
break;
}
do {
- commit = pop_most_recent_commit(&revs->commits, SEEN);
+ struct commit *commit = revs->commits->item;
+
if (commit->object.flags & (UNINTERESTING|SHOWN))
- continue;
+ goto next;
if (revs->min_age != -1 && (commit->date > revs->min_age))
- continue;
+ goto next;
if (revs->max_age != -1 && (commit->date < revs->max_age))
return NULL;
if (revs->no_merges && commit->parents && commit->parents->next)
- continue;
+ goto next;
if (revs->paths && revs->dense) {
if (!(commit->object.flags & TREECHANGE))
- continue;
+ goto next;
rewrite_parents(commit);
}
+ /* More to go? */
+ if (revs->max_count)
+ pop_most_recent_commit(&revs->commits, SEEN);
commit->object.flags |= SHOWN;
return commit;
+next:
+ pop_most_recent_commit(&revs->commits, SEEN);
} while (revs->commits);
return NULL;
}