1
0
mirror of https://github.com/git/git.git synced 2024-10-21 09:18:12 +02:00

git-svn: speed up find_rev_before

By limiting start revision of find_rev_before to max existing
revision.  This avoids a long wait if you do
'git svn reset -r 9999999'.  The linear search within the
contiguous revisions doesn't seem to be a problem.

[ew: expanded commit message]

Signed-off-by: Ben Jackson <ben@ben.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Ben Jackson 2009-06-03 20:45:51 -07:00 committed by Eric Wong
parent 9a8c92ac9e
commit ca5e880ec2

@ -3171,6 +3171,8 @@ sub find_rev_before {
my ($self, $rev, $eq_ok, $min_rev) = @_; my ($self, $rev, $eq_ok, $min_rev) = @_;
--$rev unless $eq_ok; --$rev unless $eq_ok;
$min_rev ||= 1; $min_rev ||= 1;
my $max_rev = $self->rev_map_max;
$rev = $max_rev if ($rev > $max_rev);
while ($rev >= $min_rev) { while ($rev >= $min_rev) {
if (my $c = $self->rev_map_get($rev)) { if (my $c = $self->rev_map_get($rev)) {
return ($rev, $c); return ($rev, $c);