{"thread":{"id":"5210","subject":"[PATCH] git-svn: bugfix: allow SVN:: lib users to track the root of the repository","startedAt":"2006-08-11T18:11:28Z","lastAt":"2006-08-12T06:21:41Z","messageCount":4,"participants":["Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"25136","messageId":"11553198891741-git-send-email-normalperson@yhbt.net","threadId":"5210","inReplyTo":null,"subject":"[PATCH] git-svn: split the path from the url correctly with limited perms","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-08-11T18:11:28Z","receivedAt":"2006-08-11T18:11:28Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"This version of the splitter (that only affects SVN:: library\nusers) works when one only has limited read-permissions to\nthe repository they're fetching from.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |   25 +++++++++++--------------\n 1 files changed, 11 insertions(+), 14 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 6453771..a033237 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1160,27 +1160,24 @@ sub repo_path_split {\n \t\t}\n \t}\n \n-\tmy ($url, $path) = ($full_url =~ m!^([a-z\\+]+://[^/]*)(.*)$!i);\n-\t$path =~ s#^/+##;\n-\tmy @paths = split(m#/+#, $path);\n-\n \tif ($_use_lib) {\n-\t\twhile (1) {\n-\t\t\t$SVN = libsvn_connect($url);\n-\t\t\tlast if (defined $SVN &&\n-\t\t\t\tdefined eval { $SVN->get_latest_revnum });\n-\t\t\tmy $n = shift @paths || last;\n-\t\t\t$url .= \"/$n\";\n-\t\t}\n+\t\t$SVN = libsvn_connect($full_url);\n+\t\tmy $url = $SVN->get_repos_root;\n+\t\t$full_url =~ s#^\\Q$url\\E/*##;\n+\t\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n+\t\treturn ($url, $full_url);\n \t} else {\n+\t\tmy ($url, $path) = ($full_url =~ m!^([a-z\\+]+://[^/]*)(.*)$!i);\n+\t\t$path =~ s#^/+##;\n+\t\tmy @paths = split(m#/+#, $path);\n \t\twhile (quiet_run(qw/svn ls --non-interactive/, $url)) {\n \t\t\tmy $n = shift @paths || last;\n \t\t\t$url .= \"/$n\";\n \t\t}\n+\t\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n+\t\t$path = join('/',@paths);\n+\t\treturn ($url, $path);\n \t}\n-\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n-\t$path = join('/',@paths);\n-\treturn ($url, $path);\n }\n \n sub setup_git_svn {\n-- \n1.4.2.rc1.g018f\n"},{"id":"25135","messageId":"11553198912549-git-send-email-normalperson@yhbt.net","threadId":"5210","inReplyTo":"11553198891741-git-send-email-normalperson@yhbt.net","subject":"[PATCH] git-svn: bugfix: allow SVN:: lib users to track the root of the repository","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-08-11T18:11:29Z","receivedAt":"2006-08-11T18:11:29Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"I'm not sure if anybody has hit this (besides me), but this\nfixes the problem where I ran into while attempting to import a\nsmall repo at the root level:  I ended up with all the commits, but\nwith no file/tree changes at all throughout the entire history.\n\nAlso, fix a warning if the commit message is not defined for revision 0.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex a033237..fb792be 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2614,7 +2614,9 @@ sub libsvn_connect {\n sub libsvn_get_file {\n \tmy ($gui, $f, $rev) = @_;\n \tmy $p = $f;\n-\treturn unless ($p =~ s#^\\Q$SVN_PATH\\E/##);\n+\tif (length $SVN_PATH > 0) {\n+\t\treturn unless ($p =~ s#^\\Q$SVN_PATH\\E/##);\n+\t}\n \n \tmy ($hash, $pid, $in, $out);\n \tmy $pool = SVN::Pool->new;\n@@ -2661,6 +2663,7 @@ sub libsvn_log_entry {\n \tif (defined $_authors && ! defined $users{$author}) {\n \t\tdie \"Author: $author not defined in $_authors file\\n\";\n \t}\n+\t$msg = '' if ($rev == 0 && !defined $msg);\n \treturn { revision => $rev, date => \"+0000 $Y-$m-$d $H:$M:$S\",\n \t\tauthor => $author, msg => $msg.\"\\n\", parents => $parents || [] }\n }\n-- \n1.4.2.rc1.g018f\n"},{"id":"25145","messageId":"7vac6asux4.fsf@assigned-by-dhcp.cox.net","threadId":"5210","inReplyTo":"11553198891741-git-send-email-normalperson@yhbt.net","subject":"Re: [PATCH] git-svn: split the path from the url correctly with limited perms","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-11T23:40:39Z","receivedAt":"2006-08-11T23:40:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> This version of the splitter (that only affects SVN:: library\n> users) works when one only has limited read-permissions to\n> the repository they're fetching from.\n\nThis seems to break all of t9100 series test without\nGIT_SVN_NO_LIB environment set.\n\n\"dpkg -l libsvn-core-perl\" reports 1.3.2-3 here.\n\n$ for i in t91*; do echo $i; sh $i; done\nt9100-git-svn-basic.sh\ndefine NO_SVN_TESTS to skip git-svn tests\n*   ok 1: initialize git-svn\nFATAL: Unexpected exit with code 255\nt9101-git-svn-props.sh\n*   ok 1: checkout working copy from svn\n*   ok 2: setup some commits to svn\n*   ok 3: initialize git-svn\nFATAL: Unexpected exit with code 255\nt9102-git-svn-deep-rmdir.sh\n*   ok 1: initialize repo\nFATAL: Unexpected exit with code 255\nt9103-git-svn-graft-branches.sh\nFATAL: Unexpected exit with code 255\nt9104-git-svn-follow-parent.sh\n*   ok 1: initialize repo\nFATAL: Unexpected exit with code 255\nt9105-git-svn-commit-diff.sh\n*   ok 1: initialize repo\nFATAL: Unexpected exit with code 9\n\n$ sh t9100-git-svn-basic.sh -i -v\ndefine NO_SVN_TESTS to skip git-svn tests\n* expecting success: git-svn init file:///git/t/trash/svnrepo/test-git-svn\n*   ok 1: initialize git-svn\n* expecting success: git-svn fetch\n11 at /git/t/../git-svn line 422\n        main::fetch_lib() called at /git/t/../git-svn line 290\n        main::fetch() called at /git/t/../git-svn line 149\nFATAL: Unexpected exit with code 255\n"},{"id":"25154","messageId":"20060812062134.GA7609@localdomain","threadId":"5210","inReplyTo":"7vac6asux4.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] git-svn: split the path from the url correctly with limited perms","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-08-12T06:21:41Z","receivedAt":"2006-08-12T06:21:41Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"This version of the splitter (that only affects SVN:: library\nusers) works when one only has limited read-permissions to\nthe repository they're fetching from.\n\nUpdated from the original patch to workaround some SVN bug\nsomewhere, which only seems to happen against file://\nrepositories...  Here's the diff against the original patch I\nsubmitted:\n\n@@ -1159,8 +1159,8 @@ sub repo_path_split {\n \t}\n\n \tif ($_use_lib) {\n-\t\t$SVN = libsvn_connect($full_url);\n-\t\tmy $url = $SVN->get_repos_root;\n+\t\tmy $tmp = libsvn_connect($full_url);\n+\t\tmy $url = $tmp->get_repos_root;\n \t\t$full_url =~ s#^\\Q$url\\E/*##;\n \t\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n \t\treturn ($url, $full_url);\n\nSomehow connecting to a repository with the full url makes the\nreturned SVN::Ra object act strangely and break things, so now\nwe just drop the SVN::Ra object that we made our initial\nconnection with...\n\nThanks to Junio for remembering to run the test suite when I\nthought the change was too trivial (I tested it against remote\nrepostories, of course).\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |   25 +++++++++++--------------\n 1 files changed, 11 insertions(+), 14 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 7d9839e..0d58bb9 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1158,27 +1158,24 @@ sub repo_path_split {\n \t\t}\n \t}\n \n-\tmy ($url, $path) = ($full_url =~ m!^([a-z\\+]+://[^/]*)(.*)$!i);\n-\t$path =~ s#^/+##;\n-\tmy @paths = split(m#/+#, $path);\n-\n \tif ($_use_lib) {\n-\t\twhile (1) {\n-\t\t\t$SVN = libsvn_connect($url);\n-\t\t\tlast if (defined $SVN &&\n-\t\t\t\tdefined eval { $SVN->get_latest_revnum });\n-\t\t\tmy $n = shift @paths || last;\n-\t\t\t$url .= \"/$n\";\n-\t\t}\n+\t\tmy $tmp = libsvn_connect($full_url);\n+\t\tmy $url = $tmp->get_repos_root;\n+\t\t$full_url =~ s#^\\Q$url\\E/*##;\n+\t\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n+\t\treturn ($url, $full_url);\n \t} else {\n+\t\tmy ($url, $path) = ($full_url =~ m!^([a-z\\+]+://[^/]*)(.*)$!i);\n+\t\t$path =~ s#^/+##;\n+\t\tmy @paths = split(m#/+#, $path);\n \t\twhile (quiet_run(qw/svn ls --non-interactive/, $url)) {\n \t\t\tmy $n = shift @paths || last;\n \t\t\t$url .= \"/$n\";\n \t\t}\n+\t\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n+\t\t$path = join('/',@paths);\n+\t\treturn ($url, $path);\n \t}\n-\tpush @repo_path_split_cache, qr/^(\\Q$url\\E)/;\n-\t$path = join('/',@paths);\n-\treturn ($url, $path);\n }\n \n sub setup_git_svn {\n-- \n1.4.1.g018f\n"}]}