All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-svn: split the path from the url correctly with limited perms
@ 2006-08-11 18:11 Eric Wong
  2006-08-11 18:11 ` [PATCH] git-svn: bugfix: allow SVN:: lib users to track the root of the repository Eric Wong
  2006-08-11 23:40 ` [PATCH] git-svn: split the path from the url correctly with limited perms Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Wong @ 2006-08-11 18:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eric Wong

This version of the splitter (that only affects SVN:: library
users) works when one only has limited read-permissions to
the repository they're fetching from.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 6453771..a033237 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1160,27 +1160,24 @@ sub repo_path_split {
 		}
 	}
 
-	my ($url, $path) = ($full_url =~ m!^([a-z\+]+://[^/]*)(.*)$!i);
-	$path =~ s#^/+##;
-	my @paths = split(m#/+#, $path);
-
 	if ($_use_lib) {
-		while (1) {
-			$SVN = libsvn_connect($url);
-			last if (defined $SVN &&
-				defined eval { $SVN->get_latest_revnum });
-			my $n = shift @paths || last;
-			$url .= "/$n";
-		}
+		$SVN = libsvn_connect($full_url);
+		my $url = $SVN->get_repos_root;
+		$full_url =~ s#^\Q$url\E/*##;
+		push @repo_path_split_cache, qr/^(\Q$url\E)/;
+		return ($url, $full_url);
 	} else {
+		my ($url, $path) = ($full_url =~ m!^([a-z\+]+://[^/]*)(.*)$!i);
+		$path =~ s#^/+##;
+		my @paths = split(m#/+#, $path);
 		while (quiet_run(qw/svn ls --non-interactive/, $url)) {
 			my $n = shift @paths || last;
 			$url .= "/$n";
 		}
+		push @repo_path_split_cache, qr/^(\Q$url\E)/;
+		$path = join('/',@paths);
+		return ($url, $path);
 	}
-	push @repo_path_split_cache, qr/^(\Q$url\E)/;
-	$path = join('/',@paths);
-	return ($url, $path);
 }
 
 sub setup_git_svn {
-- 
1.4.2.rc1.g018f

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-12  6:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-11 18:11 [PATCH] git-svn: split the path from the url correctly with limited perms Eric Wong
2006-08-11 18:11 ` [PATCH] git-svn: bugfix: allow SVN:: lib users to track the root of the repository Eric Wong
2006-08-11 23:40 ` [PATCH] git-svn: split the path from the url correctly with limited perms Junio C Hamano
2006-08-12  6:21   ` Eric Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.