* [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
* [PATCH] git-svn: bugfix: allow SVN:: lib users to track the root of the repository
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 ` Eric Wong
2006-08-11 23:40 ` [PATCH] git-svn: split the path from the url correctly with limited perms Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Eric Wong @ 2006-08-11 18:11 UTC (permalink / raw
To: Junio C Hamano; +Cc: git, Eric Wong
I'm not sure if anybody has hit this (besides me), but this
fixes the problem where I ran into while attempting to import a
small repo at the root level: I ended up with all the commits, but
with no file/tree changes at all throughout the entire history.
Also, fix a warning if the commit message is not defined for revision 0.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
git-svn.perl | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index a033237..fb792be 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2614,7 +2614,9 @@ sub libsvn_connect {
sub libsvn_get_file {
my ($gui, $f, $rev) = @_;
my $p = $f;
- return unless ($p =~ s#^\Q$SVN_PATH\E/##);
+ if (length $SVN_PATH > 0) {
+ return unless ($p =~ s#^\Q$SVN_PATH\E/##);
+ }
my ($hash, $pid, $in, $out);
my $pool = SVN::Pool->new;
@@ -2661,6 +2663,7 @@ sub libsvn_log_entry {
if (defined $_authors && ! defined $users{$author}) {
die "Author: $author not defined in $_authors file\n";
}
+ $msg = '' if ($rev == 0 && !defined $msg);
return { revision => $rev, date => "+0000 $Y-$m-$d $H:$M:$S",
author => $author, msg => $msg."\n", parents => $parents || [] }
}
--
1.4.2.rc1.g018f
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-svn: split the path from the url correctly with limited perms
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 ` Junio C Hamano
2006-08-12 6:21 ` Eric Wong
1 sibling, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2006-08-11 23:40 UTC (permalink / raw
To: Eric Wong; +Cc: git
Eric Wong <normalperson@yhbt.net> writes:
> 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.
This seems to break all of t9100 series test without
GIT_SVN_NO_LIB environment set.
"dpkg -l libsvn-core-perl" reports 1.3.2-3 here.
$ for i in t91*; do echo $i; sh $i; done
t9100-git-svn-basic.sh
define NO_SVN_TESTS to skip git-svn tests
* ok 1: initialize git-svn
FATAL: Unexpected exit with code 255
t9101-git-svn-props.sh
* ok 1: checkout working copy from svn
* ok 2: setup some commits to svn
* ok 3: initialize git-svn
FATAL: Unexpected exit with code 255
t9102-git-svn-deep-rmdir.sh
* ok 1: initialize repo
FATAL: Unexpected exit with code 255
t9103-git-svn-graft-branches.sh
FATAL: Unexpected exit with code 255
t9104-git-svn-follow-parent.sh
* ok 1: initialize repo
FATAL: Unexpected exit with code 255
t9105-git-svn-commit-diff.sh
* ok 1: initialize repo
FATAL: Unexpected exit with code 9
$ sh t9100-git-svn-basic.sh -i -v
define NO_SVN_TESTS to skip git-svn tests
* expecting success: git-svn init file:///git/t/trash/svnrepo/test-git-svn
* ok 1: initialize git-svn
* expecting success: git-svn fetch
11 at /git/t/../git-svn line 422
main::fetch_lib() called at /git/t/../git-svn line 290
main::fetch() called at /git/t/../git-svn line 149
FATAL: Unexpected exit with code 255
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] git-svn: split the path from the url correctly with limited perms
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
0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2006-08-12 6:21 UTC (permalink / raw
To: Junio C Hamano; +Cc: git
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.
Updated from the original patch to workaround some SVN bug
somewhere, which only seems to happen against file://
repositories... Here's the diff against the original patch I
submitted:
@@ -1159,8 +1159,8 @@ sub repo_path_split {
}
if ($_use_lib) {
- $SVN = libsvn_connect($full_url);
- my $url = $SVN->get_repos_root;
+ my $tmp = libsvn_connect($full_url);
+ my $url = $tmp->get_repos_root;
$full_url =~ s#^\Q$url\E/*##;
push @repo_path_split_cache, qr/^(\Q$url\E)/;
return ($url, $full_url);
Somehow connecting to a repository with the full url makes the
returned SVN::Ra object act strangely and break things, so now
we just drop the SVN::Ra object that we made our initial
connection with...
Thanks to Junio for remembering to run the test suite when I
thought the change was too trivial (I tested it against remote
repostories, of course).
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 7d9839e..0d58bb9 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1158,27 +1158,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";
- }
+ my $tmp = libsvn_connect($full_url);
+ my $url = $tmp->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.1.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
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).