git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv2 1/2] Limit start revision of find_rev_before to max existing revision

From
Ben Jackson <ben@ben.com>
Date
Jun 4, 2009, 03:45 UTC
Message-ID
<1244087152-17002-1-git-send-email-ben@ben.com>
Signed-off-by: Ben Jackson <ben@ben.com>
---
On Wed, Jun 03, 2009 at 05:24:06PM -0700, Eric Wong wrote:
>
> find_rev_before can certainly be improved.  I haven't noticed
> performance issues with it myself, but you should be able to improve it.

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.

 git-svn.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 20bf828..b77710c 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3130,6 +3130,8 @@ sub find_rev_before {
 	my ($self, $rev, $eq_ok, $min_rev) = @_;
 	--$rev unless $eq_ok;
 	$min_rev ||= 1;
+	my $max_rev = $self->rev_map_max;
+	$rev = $max_rev if ($rev > $max_rev);
 	while ($rev >= $min_rev) {
 		if (my $c = $self->rev_map_get($rev)) {
 			return ($rev, $c);
-- 
1.6.3.GIT
Next: Ben Jackson
Message 1 of 3 in “[PATCHv2 1/2] Limit start revision of find_rev_before to max existing revision”
  1. Ben JacksonJun 4, 2009
  2. 2/2 Add 'git svn reset' to unwind 'git svn fetch'Ben Jackson, Jun 4, 2009
  3. Eric WongJun 4, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.