# [PATCH 2/2] git-svn: Correctly report max revision when following deleted paths

3 messages from 2009-05-06 to 2009-05-10. Participants: Alex Vandiver, Eric Wong.
Thread: https://gitlist.dev/t/19205

## Alex Vandiver, 2009-05-06 20:18

Subject: [PATCH 1/2] git-svn: Fix for svn paths removed > log-window-size revisions ago
Message-ID: <1241641133-6974-1-git-send-email-alexmv@mit.edu>
URL: https://gitlist.dev/e/1241641133-6974-1-git-send-email-alexmv%40mit.edu

```
Instead of trying to find the end of the commit history only in the
last window, track if we have seen commits yet, and use that to judge
if we need to backtrack and look for a tail.  Otherwise, conversion
can silently lose up to 100 revisions of a branch if it was deleted
>100 revisions ago.

Signed-off-by: Alex Vandiver <alexmv@mit.edu>
---
 git-svn.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index ef1d30d..5836dde 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4438,6 +4438,7 @@ sub gs_fetch_loop_common {
 	my ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);
 	my $longest_path = longest_common_path($gsv, $globs);
 	my $ra_url = $self->{url};
+	my $find_trailing_edge;
 	while (1) {
 		my %revs;
 		my $err;
@@ -4455,8 +4456,10 @@ sub gs_fetch_loop_common {
 		               sub { $revs{$_[1]} = _cb(@_) });
 		if ($err) {
 			print "Checked through r$max\r";
+		} else {
+			$find_trailing_edge = 1;
 		}
-		if ($err && $max >= $head) {
+		if ($err and $find_trailing_edge) {
 			print STDERR "Path '$longest_path' ",
 				     "was probably deleted:\n",
 				     $err->expanded_message,
@@ -4475,6 +4478,7 @@ sub gs_fetch_loop_common {
 					last;
 				}
 			}
+			$find_trailing_edge = 0;
 		}
 		$SVN::Error::handler = $err_handler;
 
-- 
1.6.3.rc4.225.g060aa4

```

## Alex Vandiver, 2009-05-06 20:18

Subject: [PATCH 2/2] git-svn: Correctly report max revision when following deleted paths
Message-ID: <1241641133-6974-2-git-send-email-alexmv@mit.edu>
URL: https://gitlist.dev/e/1241641133-6974-2-git-send-email-alexmv%40mit.edu
In-Reply-To: <1241641133-6974-1-git-send-email-alexmv@mit.edu>

```
Report the maximum found revision in the range, instead of the minimum
changed revision.

Signed-off-by: Alex Vandiver <alexmv@mit.edu>
---
 git-svn.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 5836dde..eebcf0f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4471,7 +4471,7 @@ sub gs_fetch_loop_common {
 				my $ok;
 				$self->get_log([$longest_path], $min, $hi,
 				               0, 1, 1, sub {
-				               $ok ||= $_[1];
+				               $ok = $_[1];
 				               $revs{$_[1]} = _cb(@_) });
 				if ($ok) {
 					print STDERR "r$min .. r$ok OK\n";
-- 
1.6.3.rc4.225.g060aa4

```

## Eric Wong, 2009-05-10 01:32

Subject: Re: [PATCH 1/2] git-svn: Fix for svn paths removed > log-window-size revisions ago
Message-ID: <20090510013211.GB2000@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090510013211.GB2000%40dcvr.yhbt.net
In-Reply-To: <1241641133-6974-1-git-send-email-alexmv@mit.edu>

```
Alex Vandiver <alexmv@MIT.EDU> wrote:
> Instead of trying to find the end of the commit history only in the
> last window, track if we have seen commits yet, and use that to judge
> if we need to backtrack and look for a tail.  Otherwise, conversion
> can silently lose up to 100 revisions of a branch if it was deleted
> >100 revisions ago.
> 
> Signed-off-by: Alex Vandiver <alexmv@mit.edu>

Thanks Alex,

This series (and your svn.authorsfile patch)
Acked-by: Eric Wong <normalperson@yhbt.net>

..and pushed out to git://git.bogomips.org/git-svn
-- 
Eric Wong

```
