aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-03-05 09:53:52 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-05 13:35:41 -0800
commitea5ed3abce724725360be88663cec1add7547d46 (patch)
tree5daa32b402057832930e466334967d2b9cc4e4e9 /revision.c
parent872d001f7f576b2d32f6278dc265d6449787b714 (diff)
downloadgit-ea5ed3abce724725360be88663cec1add7547d46.tar.gz
git-ea5ed3abce724725360be88663cec1add7547d46.tar.xz
get_revision(): do not dig deeper when we know we are at the end.
This resurrects the special casing for "rev-list -n 1" which avoided reading parents unnecessarily. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/revision.c b/revision.c
index a3df81007..2a33637f6 100644
--- a/revision.c
+++ b/revision.c
@@ -684,13 +684,11 @@ static void rewrite_parents(struct commit *commit)
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;
@@ -701,22 +699,28 @@ struct commit *get_revision(struct rev_info *revs)
}
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;
}