summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-07-20 02:06:24 -0700
committerEric Wong <normalperson@yhbt.net>2009-07-22 23:45:29 -0700
commit4aacaeb3dc82bb6479e70e120053dc27a399460e (patch)
treec6c4f11b5117d58587d612866b8bf87b625d126c /git-svn.perl
parent0ad8ff2cd185e84fd49dd961370411e379681f10 (diff)
downloadgit-4aacaeb3dc82bb6479e70e120053dc27a399460e.tar.gz
git svn: fix shallow clone when upstream revision is too new
Thanks to Ka-Hing Cheung for the initial bug report and patch: > git-svn uses $ra->get_latest_revnum to find out the latest > revision, but that can be problematic, because get_latest_revnum > returns the latest revnum in the entire repository, not > restricted by whatever URL you used to construct $ra. So if you > do git svn clone -r HEAD svn://blah/blah/trunk, it won't work if > the latest checkin is in one of the branches (it will try to > fetch a rev that doesn't exist in trunk, making the clone > useless). Relying on SVN::Core::INVALID_REVNUM (-1) as the "start" argument to SVN::Ra::get_log() proved unreliable with http(s) URLs so the result of SVN::Ra::get_latest_revnum() is used as the "start" argument instead. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 43c86e85a1..9369acc4dc 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1647,6 +1647,7 @@ sub fetch_all {
my $ra = Git::SVN::Ra->new($url);
my $uuid = $ra->get_uuid;
my $head = $ra->get_latest_revnum;
+ $ra->get_log("", $head, 0, 1, 0, 1, sub { $head = $_[1] });
my $base = defined $fetch ? $head : 0;
# read the max revs for wildcard expansion (branches/*, tags/*)