{"thread":{"id":"31117","subject":"Make git-svn Use accessors for paths and urls","startedAt":"2012-07-27T20:00:47Z","lastAt":"2012-09-18T00:07:37Z","messageCount":18,"participants":["Michael G. Schwern","Eric Wong","Jonathan Nieder","Michael G Schwern","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"195957","messageId":"1343419252-9447-1-git-send-email-schwern@pobox.com","threadId":"31117","inReplyTo":null,"subject":"Make git-svn Use accessors for paths and urls","fromName":"Michael G. Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-27T20:00:47Z","receivedAt":"2012-07-27T20:00:47Z","isPatch":false,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"This patch series gives Git::SVN and Git::SVN::Ra accessors for\npath and url and then makes the rest of the code use them, rather\nthan grab at $obj->{path} and $obj->{url}.  This then will give\nus the control necessary to canonicalize them as early as\npossible (done in the next patch series).\n\nThere are plenty of other places in the code which will benefit\nfrom accessors and functions, but those will come later.  path\nand url were the most obvious.\n\nThis is a refactoring and has no functional change.  All git-svn\ntests pass with SVN 1.6 for each patch.\n\nThis goes on top of my previous patch series to extract other\nclasses.  That hasn't been reviewed yet, but both that and this are\na simple patch series and I figure we can review a bit ahead.\n\nThis is the last refactoring patch series.  After this bugs, start\ngetting fixed.\n"},{"id":"195961","messageId":"1343419252-9447-2-git-send-email-schwern@pobox.com","threadId":"31117","inReplyTo":"1343419252-9447-1-git-send-email-schwern@pobox.com","subject":"[PATCH 1/5] Make Git::SVN use accessors internally for path.","fromName":"Michael G. Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-27T20:00:48Z","receivedAt":"2012-07-27T20:00:48Z","isPatch":true,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"From: \"Michael G. Schwern\" <schwern@pobox.com>\n\nThen later it can be canonicalized automatically rather than everywhere\nits used.\n\nLater patch will make other things use it.\n---\n perl/Git/SVN.pm | 87 +++++++++++++++++++++++++++++++++++++--------------------\n 1 file changed, 56 insertions(+), 31 deletions(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex b8b3474..0aff9d0 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -314,12 +314,12 @@ sub init_remote_config {\n \t\t\t\tprint STDERR \"Using higher level of URL: \",\n \t\t\t\t\t     \"$url => $min_url\\n\";\n \t\t\t}\n-\t\t\tmy $old_path = $self->{path};\n-\t\t\t$self->{path} = $url;\n-\t\t\t$self->{path} =~ s!^\\Q$min_url\\E(/|$)!!;\n+\t\t\tmy $old_path = $self->path;\n+\t\t\t$url =~ s!^\\Q$min_url\\E(/|$)!!;\n \t\t\tif (length $old_path) {\n-\t\t\t\t$self->{path} .= \"/$old_path\";\n+\t\t\t\t$url .= \"/$old_path\";\n \t\t\t}\n+\t\t\t$self->path($url);\n \t\t\t$url = $min_url;\n \t\t}\n \t}\n@@ -343,11 +343,13 @@ sub init_remote_config {\n \tunless ($no_write) {\n \t\tcommand_noisy('config',\n \t\t\t      \"svn-remote.$self->{repo_id}.url\", $url);\n-\t\t$self->{path} =~ s{^/}{};\n-\t\t$self->{path} =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n+\t\tmy $path = $self->path;\n+\t\t$path =~ s{^/}{};\n+\t\t$path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n+\t\t$self->path($path);\n \t\tcommand_noisy('config', '--add',\n \t\t\t      \"svn-remote.$self->{repo_id}.fetch\",\n-\t\t\t      \"$self->{path}:\".$self->refname);\n+\t\t\t      $self->path.\":\".$self->refname);\n \t}\n \t$self->{url} = $url;\n }\n@@ -435,17 +437,22 @@ sub new {\n \t\t}\n \t}\n \tmy $self = _new($class, $repo_id, $ref_id, $path);\n-\tif (!defined $self->{path} || !length $self->{path}) {\n+\tif (!defined $self->path || !length $self->path) {\n \t\tmy $fetch = command_oneline('config', '--get',\n \t\t                            \"svn-remote.$repo_id.fetch\",\n \t\t                            \":$ref_id\\$\") or\n \t\t     die \"Failed to read \\\"svn-remote.$repo_id.fetch\\\" \",\n \t\t         \"\\\":$ref_id\\$\\\" in config\\n\";\n-\t\t($self->{path}, undef) = split(/\\s*:\\s*/, $fetch);\n+\t\tmy($path) = split(/\\s*:\\s*/, $fetch);\n+\t\t$self->path($path);\n+\t}\n+\t{\n+\t\tmy $path = $self->path;\n+\t\t$path =~ s{/+}{/}g;\n+\t\t$path =~ s{\\A/}{};\n+\t\t$path =~ s{/\\z}{};\n+\t\t$self->path($path);\n \t}\n-\t$self->{path} =~ s{/+}{/}g;\n-\t$self->{path} =~ s{\\A/}{};\n-\t$self->{path} =~ s{/\\z}{};\n \t$self->{url} = command_oneline('config', '--get',\n \t                               \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n@@ -567,7 +574,7 @@ sub _set_svm_vars {\n \t}\n \n \tmy $r = $ra->get_latest_revnum;\n-\tmy $path = $self->{path};\n+\tmy $path = $self->path;\n \tmy %tried;\n \twhile (length $path) {\n \t\tunless ($tried{\"$self->{url}/$path\"}) {\n@@ -728,7 +735,7 @@ sub prop_walk {\n \t$path =~ s#^/*#/#g;\n \tmy $p = $path;\n \t# Strip the irrelevant part of the path.\n-\t$p =~ s#^/+\\Q$self->{path}\\E(/|$)#/#;\n+\t$p =~ s#^/+\\Q@{[$self->path]}\\E(/|$)#/#;\n \t# Ensure the path is terminated by a `/'.\n \t$p =~ s#/*$#/#;\n \n@@ -749,7 +756,7 @@ sub prop_walk {\n \n \tforeach (sort keys %$dirent) {\n \t\tnext if $dirent->{$_}->{kind} != $SVN::Node::dir;\n-\t\t$self->prop_walk($self->{path} . $p . $_, $rev, $sub);\n+\t\t$self->prop_walk($self->path . $p . $_, $rev, $sub);\n \t}\n }\n \n@@ -920,19 +927,19 @@ sub rewrite_uuid {\n sub metadata_url {\n \tmy ($self) = @_;\n \t($self->rewrite_root || $self->{url}) .\n-\t   (length $self->{path} ? '/' . $self->{path} : '');\n+\t   (length $self->path ? '/' . $self->path : '');\n }\n \n sub full_url {\n \tmy ($self) = @_;\n-\t$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');\n+\t$self->{url} . (length $self->path ? '/' . $self->path : '');\n }\n \n sub full_pushurl {\n \tmy ($self) = @_;\n \tif ($self->{pushurl}) {\n-\t\treturn $self->{pushurl} . (length $self->{path} ? '/' .\n-\t\t       $self->{path} : '');\n+\t\treturn $self->{pushurl} . (length $self->path ? '/' .\n+\t\t       $self->path : '');\n \t} else {\n \t\treturn $self->full_url;\n \t}\n@@ -1048,20 +1055,20 @@ sub do_git_commit {\n \n sub match_paths {\n \tmy ($self, $paths, $r) = @_;\n-\treturn 1 if $self->{path} eq '';\n-\tif (my $path = $paths->{\"/$self->{path}\"}) {\n+\treturn 1 if $self->path eq '';\n+\tif (my $path = $paths->{\"/\".$self->path}) {\n \t\treturn ($path->{action} eq 'D') ? 0 : 1;\n \t}\n-\t$self->{path_regex} ||= qr/^\\/\\Q$self->{path}\\E\\//;\n+\t$self->{path_regex} ||= qr{^/\\Q@{[$self->path]}\\E/};\n \tif (grep /$self->{path_regex}/, keys %$paths) {\n \t\treturn 1;\n \t}\n \tmy $c = '';\n-\tforeach (split m#/#, $self->{path}) {\n+\tforeach (split m#/#, $self->path) {\n \t\t$c .= \"/$_\";\n \t\tnext unless ($paths->{$c} &&\n \t\t             ($paths->{$c}->{action} =~ /^[AR]$/));\n-\t\tif ($self->ra->check_path($self->{path}, $r) ==\n+\t\tif ($self->ra->check_path($self->path, $r) ==\n \t\t    $SVN::Node::dir) {\n \t\t\treturn 1;\n \t\t}\n@@ -1075,14 +1082,14 @@ sub find_parent_branch {\n \tunless (defined $paths) {\n \t\tmy $err_handler = $SVN::Error::handler;\n \t\t$SVN::Error::handler = \\&Git::SVN::Ra::skip_unknown_revs;\n-\t\t$self->ra->get_log([$self->{path}], $rev, $rev, 0, 1, 1,\n+\t\t$self->ra->get_log([$self->path], $rev, $rev, 0, 1, 1,\n \t\t\t\t   sub { $paths = $_[0] });\n \t\t$SVN::Error::handler = $err_handler;\n \t}\n \treturn undef unless defined $paths;\n \n \t# look for a parent from another branch:\n-\tmy @b_path_components = split m#/#, $self->{path};\n+\tmy @b_path_components = split m#/#, $self->path;\n \tmy @a_path_components;\n \tmy $i;\n \twhile (@b_path_components) {\n@@ -1235,7 +1242,7 @@ sub mkemptydirs {\n \t\tclose $fh;\n \t}\n \n-\tmy $strip = qr/\\A\\Q$self->{path}\\E(?:\\/|$)/;\n+\tmy $strip = qr/\\A\\Q@{[$self->path]}\\E(?:\\/|$)/;\n \tforeach my $d (sort keys %empty_dirs) {\n \t\t$d = uri_decode($d);\n \t\t$d =~ s/$strip//;\n@@ -1858,7 +1865,7 @@ sub make_log_entry {\n \t\t$commit_email ||= \"$author\\@$uuid\";\n \t} elsif ($self->use_svnsync_props) {\n \t\tmy $full_url = $self->svnsync->{url};\n-\t\t$full_url .= \"/$self->{path}\" if length $self->{path};\n+\t\t$full_url .= \"/\".$self->path if length $self->path;\n \t\tremove_username($full_url);\n \t\tmy $uuid = $self->svnsync->{uuid};\n \t\t$log_entry{metadata} = \"$full_url\\@$rev $uuid\";\n@@ -1905,7 +1912,7 @@ sub set_tree {\n \t                tree_b => $tree,\n \t                editor_cb => sub {\n \t\t\t       $self->set_tree_cb($log_entry, $tree, @_) },\n-\t                svn_path => $self->{path} );\n+\t                svn_path => $self->path );\n \tif (!Git::SVN::Editor->new(\\%ed_opts)->apply_diff) {\n \t\tprint \"No changes\\nr$self->{last_rev} = $tree\\n\";\n \t}\n@@ -2276,10 +2283,28 @@ sub _new {\n \n \t$_[3] = $path = '' unless (defined $path);\n \tmkpath([$dir]);\n-\tbless {\n+\tmy $obj = bless {\n \t\tref_id => $ref_id, dir => $dir, index => \"$dir/index\",\n-\t        path => $path, config => \"$ENV{GIT_DIR}/svn/config\",\n+\t        config => \"$ENV{GIT_DIR}/svn/config\",\n \t        map_root => \"$dir/.rev_map\", repo_id => $repo_id }, $class;\n+\n+\t# Ensure it gets canonicalized\n+\t$obj->path($path);\n+\n+\treturn $obj;\n+}\n+\n+\n+sub path {\n+    my $self = shift;\n+\n+    if( @_ ) {\n+        my $path = shift;\n+        $self->{path} = $path;\n+        return;\n+    }\n+\n+    return $self->{path};\n }\n \n # for read-only access of old .rev_db formats\n-- \n1.7.11.3\n"},{"id":"195958","messageId":"1343419252-9447-3-git-send-email-schwern@pobox.com","threadId":"31117","inReplyTo":"1343419252-9447-1-git-send-email-schwern@pobox.com","subject":"[PATCH 2/5] Make Git::SVN use an accessor for URLs internally.","fromName":"Michael G. Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-27T20:00:49Z","receivedAt":"2012-07-27T20:00:49Z","isPatch":true,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"From: \"Michael G. Schwern\" <schwern@pobox.com>\n\nSo later it can do automatic canonicalization.\n\nA later patch will make other things use the accessor.\n\nNo functional change here.\n---\n perl/Git/SVN.pm | 44 ++++++++++++++++++++++++++++++--------------\n 1 file changed, 30 insertions(+), 14 deletions(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 0aff9d0..59bca51 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -351,7 +351,7 @@ sub init_remote_config {\n \t\t\t      \"svn-remote.$self->{repo_id}.fetch\",\n \t\t\t      $self->path.\":\".$self->refname);\n \t}\n-\t$self->{url} = $url;\n+\t$self->url($url);\n }\n \n sub find_by_url { # repos_root and, path are optional\n@@ -453,9 +453,10 @@ sub new {\n \t\t$path =~ s{/\\z}{};\n \t\t$self->path($path);\n \t}\n-\t$self->{url} = command_oneline('config', '--get',\n-\t                               \"svn-remote.$repo_id.url\") or\n+\tmy $url = command_oneline('config', '--get',\n+\t                          \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n+\t$self->url($url);\n \t$self->{pushurl} = eval { command_oneline('config', '--get',\n \t                          \"svn-remote.$repo_id.pushurl\") };\n \t$self->rebuild;\n@@ -577,17 +578,18 @@ sub _set_svm_vars {\n \tmy $path = $self->path;\n \tmy %tried;\n \twhile (length $path) {\n-\t\tunless ($tried{\"$self->{url}/$path\"}) {\n+\t\tmy $try = $self->url . \"/$path\";\n+\t\tunless ($tried{$try}) {\n \t\t\treturn $ra if $self->read_svm_props($ra, $path, $r);\n-\t\t\t$tried{\"$self->{url}/$path\"} = 1;\n+\t\t\t$tried{$try} = 1;\n \t\t}\n \t\t$path =~ s#/?[^/]+$##;\n \t}\n \tdie \"Path: '$path' should be ''\\n\" if $path ne '';\n \treturn $ra if $self->read_svm_props($ra, $path, $r);\n-\t$tried{\"$self->{url}/$path\"} = 1;\n+\t$tried{$self->url.\"/$path\"} = 1;\n \n-\tif ($ra->{repos_root} eq $self->{url}) {\n+\tif ($ra->{repos_root} eq $self->url) {\n \t\tdie @err, (map { \"  $_\\n\" } keys %tried), \"\\n\";\n \t}\n \n@@ -610,7 +612,7 @@ sub _set_svm_vars {\n \tif (!$ok) {\n \t\tdie @err, (map { \"  $_\\n\" } keys %tried), \"\\n\";\n \t}\n-\tGit::SVN::Ra->new($self->{url});\n+\tGit::SVN::Ra->new($self->url);\n }\n \n sub svnsync {\n@@ -677,7 +679,7 @@ sub ra_uuid {\n \t\tif (!$@ && $uuid && $uuid =~ /^([a-f\\d\\-]{30,})$/i) {\n \t\t\t$self->{ra_uuid} = $uuid;\n \t\t} else {\n-\t\t\tdie \"ra_uuid called without URL\\n\" unless $self->{url};\n+\t\t\tdie \"ra_uuid called without URL\\n\" unless $self->url;\n \t\t\t$self->{ra_uuid} = $self->ra->get_uuid;\n \t\t\ttmp_config('--add', $key, $self->{ra_uuid});\n \t\t}\n@@ -701,7 +703,7 @@ sub repos_root {\n \n sub ra {\n \tmy ($self) = shift;\n-\tmy $ra = Git::SVN::Ra->new($self->{url});\n+\tmy $ra = Git::SVN::Ra->new($self->url);\n \t$self->_set_repos_root($ra->{repos_root});\n \tif ($self->use_svm_props && !$self->{svm}) {\n \t\tif ($self->no_metadata) {\n@@ -926,13 +928,13 @@ sub rewrite_uuid {\n \n sub metadata_url {\n \tmy ($self) = @_;\n-\t($self->rewrite_root || $self->{url}) .\n+\t($self->rewrite_root || $self->url) .\n \t   (length $self->path ? '/' . $self->path : '');\n }\n \n sub full_url {\n \tmy ($self) = @_;\n-\t$self->{url} . (length $self->path ? '/' . $self->path : '');\n+\t$self->url . (length $self->path ? '/' . $self->path : '');\n }\n \n sub full_pushurl {\n@@ -1436,7 +1438,7 @@ sub find_extra_svk_parents {\n \tfor my $ticket ( @tickets ) {\n \t\tmy ($uuid, $path, $rev) = split /:/, $ticket;\n \t\tif ( $uuid eq $self->ra_uuid ) {\n-\t\t\tmy $url = $self->{url};\n+\t\t\tmy $url = $self->url;\n \t\t\tmy $repos_root = $url;\n \t\t\tmy $branch_from = $path;\n \t\t\t$branch_from =~ s{^/}{};\n@@ -1682,7 +1684,7 @@ sub find_extra_svn_parents {\n \t# are now marked as merge, we can add the tip as a parent.\n \tmy @merges = split \"\\n\", $mergeinfo;\n \tmy @merge_tips;\n-\tmy $url = $self->{url};\n+\tmy $url = $self->url;\n \tmy $uuid = $self->ra_uuid;\n \tmy %ranges;\n \tfor my $merge ( @merges ) {\n@@ -2307,6 +2309,20 @@ sub path {\n     return $self->{path};\n }\n \n+\n+sub url {\n+    my $self = shift;\n+\n+    if( @_ ) {\n+        my $url = shift;\n+        $self->{url} = $url;\n+        return;\n+    }\n+\n+    return $self->{url};\n+}\n+\n+\n # for read-only access of old .rev_db formats\n sub unlink_rev_db_symlink {\n \tmy ($self) = @_;\n-- \n1.7.11.3\n"},{"id":"195959","messageId":"1343419252-9447-4-git-send-email-schwern@pobox.com","threadId":"31117","inReplyTo":"1343419252-9447-1-git-send-email-schwern@pobox.com","subject":"[PATCH 3/5] Make Git::SVN::Ra use an accessor for URLs","fromName":"Michael G. Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-27T20:00:50Z","receivedAt":"2012-07-27T20:00:50Z","isPatch":true,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"From: \"Michael G. Schwern\" <schwern@pobox.com>\n\nLater it can canonicalize automatically.\n\nA later change will make other things use the accessor.\n\nNo functional change.\n---\n perl/Git/SVN/Ra.pm | 40 +++++++++++++++++++++++++++++-----------\n 1 file changed, 29 insertions(+), 11 deletions(-)\n\ndiff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm\nindex 23ff43e..329f855 100644\n--- a/perl/Git/SVN/Ra.pm\n+++ b/perl/Git/SVN/Ra.pm\n@@ -84,7 +84,7 @@ sub escape_url {\n sub new {\n \tmy ($class, $url) = @_;\n \t$url =~ s!/+$!!;\n-\treturn $RA if ($RA && $RA->{url} eq $url);\n+\treturn $RA if ($RA && $RA->url eq $url);\n \n \t::_req_svn();\n \n@@ -119,15 +119,33 @@ sub new {\n \t                      config => $config,\n \t\t\t      pool => SVN::Pool->new,\n \t                      auth_provider_callbacks => $callbacks);\n-\t$self->{url} = $url;\n+\t$RA = bless $self, $class;\n+\n+\t# Make sure its canonicalized\n+\t$self->url($url);\n \t$self->{svn_path} = $url;\n \t$self->{repos_root} = $self->get_repos_root;\n \t$self->{svn_path} =~ s#^\\Q$self->{repos_root}\\E(/|$)##;\n \t$self->{cache} = { check_path => { r => 0, data => {} },\n \t                   get_dir => { r => 0, data => {} } };\n-\t$RA = bless $self, $class;\n+\n+\treturn $RA;\n+}\n+\n+\n+sub url {\n+    my $self = shift;\n+\n+    if( @_ ) {\n+        my $url = shift;\n+        $self->{url} = $url;\n+        return;\n+    }\n+\n+    return $self->{url};\n }\n \n+\n sub check_path {\n \tmy ($self, $path, $r) = @_;\n \tmy $cache = $self->{cache}->{check_path};\n@@ -285,7 +303,7 @@ sub gs_do_switch {\n \tmy $path = $gs->{path};\n \tmy $pool = SVN::Pool->new;\n \n-\tmy $full_url = $self->{url};\n+\tmy $full_url = $self->url;\n \tmy $old_url = $full_url;\n \t$full_url .= '/' . $path if length $path;\n \tmy ($ra, $reparented);\n@@ -300,7 +318,7 @@ sub gs_do_switch {\n \t\t$ra_invalid = 1;\n \t} elsif ($old_url ne $full_url) {\n \t\tSVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);\n-\t\t$self->{url} = $full_url;\n+\t\t$self->url($full_url);\n \t\t$reparented = 1;\n \t}\n \n@@ -313,7 +331,7 @@ sub gs_do_switch {\n \n \tif ($reparented) {\n \t\tSVN::_Ra::svn_ra_reparent($self->{session}, $old_url, $pool);\n-\t\t$self->{url} = $old_url;\n+\t\t$self->url($old_url);\n \t}\n \n \t$pool->clear;\n@@ -362,7 +380,7 @@ sub gs_fetch_loop_common {\n \tmy $inc = $_log_window_size;\n \tmy ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);\n \tmy $longest_path = longest_common_path($gsv, $globs);\n-\tmy $ra_url = $self->{url};\n+\tmy $ra_url = $self->url;\n \tmy $find_trailing_edge;\n \twhile (1) {\n \t\tmy %revs;\n@@ -508,7 +526,7 @@ sub match_globs {\n \t\t\t\t ($self->check_path($p, $r) !=\n \t\t\t\t  $SVN::Node::dir));\n \t\t\tnext unless $p =~ /$g->{path}->{regex}/;\n-\t\t\t$exists->{$p} = Git::SVN->init($self->{url}, $p, undef,\n+\t\t\t$exists->{$p} = Git::SVN->init($self->url, $p, undef,\n \t\t\t\t\t $g->{ref}->full_path($de), 1);\n \t\t}\n \t}\n@@ -532,7 +550,7 @@ sub match_globs {\n \t\t\tnext if ($self->check_path($pathname, $r) !=\n \t\t\t         $SVN::Node::dir);\n \t\t\t$exists->{$pathname} = Git::SVN->init(\n-\t\t\t                      $self->{url}, $pathname, undef,\n+\t\t\t                      $self->url, $pathname, undef,\n \t\t\t                      $g->{ref}->full_path($p), 1);\n \t\t}\n \t\tmy $c = '';\n@@ -548,7 +566,7 @@ sub match_globs {\n \n sub minimize_url {\n \tmy ($self) = @_;\n-\treturn $self->{url} if ($self->{url} eq $self->{repos_root});\n+\treturn $self->url if ($self->url eq $self->{repos_root});\n \tmy $url = $self->{repos_root};\n \tmy @components = split(m!/!, $self->{svn_path});\n \tmy $c = '';\n@@ -568,7 +586,7 @@ sub can_do_switch {\n \tunless (defined $can_do_switch) {\n \t\tmy $pool = SVN::Pool->new;\n \t\tmy $rep = eval {\n-\t\t\t$self->do_switch(1, '', 0, $self->{url},\n+\t\t\t$self->do_switch(1, '', 0, $self->url,\n \t\t\t                 SVN::Delta::Editor->new, $pool);\n \t\t};\n \t\tif ($@) {\n-- \n1.7.11.3\n"},{"id":"195960","messageId":"1343419252-9447-5-git-send-email-schwern@pobox.com","threadId":"31117","inReplyTo":"1343419252-9447-1-git-send-email-schwern@pobox.com","subject":"[PATCH 4/5] Change the rest of the code to use Git::SVN->path instead of the hash directly.","fromName":"Michael G. Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-27T20:00:51Z","receivedAt":"2012-07-27T20:00:51Z","isPatch":true,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"From: \"Michael G. Schwern\" <schwern@pobox.com>\n\nNo functional change.\n---\n git-svn.perl            | 12 +++++++-----\n perl/Git/SVN.pm         |  4 ++--\n perl/Git/SVN/Fetcher.pm |  2 +-\n perl/Git/SVN/Ra.pm      |  6 +++---\n 4 files changed, 13 insertions(+), 11 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 5711c57..039623e 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1195,7 +1195,7 @@ sub cmd_show_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:ignore'} or return;\n@@ -1211,7 +1211,7 @@ sub cmd_show_externals {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:externals'} or return;\n@@ -1226,7 +1226,7 @@ sub cmd_create_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\t# $path is of the form /path/to/dir/\n \t\t$path = '.' . $path;\n@@ -1396,7 +1396,7 @@ sub cmd_commit_diff {\n \t\t\t      \"the command-line\\n\", $usage);\n \t\t}\n \t\t$url = $gs->{url};\n-\t\t$svn_path = $gs->{path};\n+\t\t$svn_path = $gs->path;\n \t}\n \tunless (defined $_revision) {\n \t\tfatal(\"-r|--revision is a required argument\\n\", $usage);\n@@ -1634,6 +1634,8 @@ sub post_fetch_checkout {\n sub complete_svn_url {\n \tmy ($url, $path) = @_;\n \t$path =~ s#/+$##;\n+\n+\t# If the path is not a URL...\n \tif ($path !~ m#^[a-z\\+]+://#) {\n \t\tif (!defined $url || $url !~ m#^[a-z\\+]+://#) {\n \t\t\tfatal(\"E: '$path' is not a complete URL \",\n@@ -1670,7 +1672,7 @@ sub complete_url_ls_init {\n \t\t    \"wanted to set to: $gs->{url}\\n\";\n \t}\n \tcommand_oneline('config', $k, $gs->{url}) unless $orig_url;\n-\tmy $remote_path = \"$gs->{path}/$repo_path\";\n+\tmy $remote_path = $gs->path . \"/$repo_path\";\n \t$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t$remote_path =~ s#/+#/#g;\n \t$remote_path =~ s#^/##g;\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 59bca51..fc907a0 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1123,7 +1123,7 @@ sub find_parent_branch {\n \t\t\t($base, $head) = parse_revision_argument(0, $r);\n \t\t} else {\n \t\t\tif ($r0 < $r) {\n-\t\t\t\t$gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,\n+\t\t\t\t$gs->ra->get_log([$gs->path], $r0 + 1, $r, 1,\n \t\t\t\t\t0, 1, sub { $base = $_[1] - 1 });\n \t\t\t}\n \t\t}\n@@ -1145,7 +1145,7 @@ sub find_parent_branch {\n \t\t\t# at the moment), so we can't rely on it\n \t\t\t$self->{last_rev} = $r0;\n \t\t\t$self->{last_commit} = $parent;\n-\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->{path});\n+\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->path);\n \t\t\t$gs->ra->gs_do_switch($r0, $rev, $gs,\n \t\t\t\t\t      $self->full_url, $ed)\n \t\t\t  or die \"SVN connection failed somewhere...\\n\";\ndiff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm\nindex 76fae9b..046a7a2 100644\n--- a/perl/Git/SVN/Fetcher.pm\n+++ b/perl/Git/SVN/Fetcher.pm\n@@ -83,7 +83,7 @@ sub _mark_empty_symlinks {\n \tchomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);\n \tmy ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);\n \tlocal $/ = \"\\0\";\n-\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};\n+\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->path;\n \t$pfx .= '/' if length($pfx);\n \twhile (<$ls>) {\n \t\tchomp;\ndiff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm\nindex 329f855..27dcdd5 100644\n--- a/perl/Git/SVN/Ra.pm\n+++ b/perl/Git/SVN/Ra.pm\n@@ -264,7 +264,7 @@ sub get_commit_editor {\n sub gs_do_update {\n \tmy ($self, $rev_a, $rev_b, $gs, $editor) = @_;\n \tmy $new = ($rev_a == $rev_b);\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \n \tif ($new && -e $gs->{index}) {\n \t\tunlink $gs->{index} or die\n@@ -300,7 +300,7 @@ sub gs_do_update {\n # svn_ra_reparent didn't work before 1.4)\n sub gs_do_switch {\n \tmy ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_;\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \tmy $pool = SVN::Pool->new;\n \n \tmy $full_url = $self->url;\n@@ -344,7 +344,7 @@ sub longest_common_path {\n \tmy $common_max = scalar @$gsv;\n \n \tforeach my $gs (@$gsv) {\n-\t\tmy @tmp = split m#/#, $gs->{path};\n+\t\tmy @tmp = split m#/#, $gs->path;\n \t\tmy $p = '';\n \t\tforeach (@tmp) {\n \t\t\t$p .= length($p) ? \"/$_\" : $_;\n-- \n1.7.11.3\n"},{"id":"195962","messageId":"1343419252-9447-6-git-send-email-schwern@pobox.com","threadId":"31117","inReplyTo":"1343419252-9447-1-git-send-email-schwern@pobox.com","subject":"[PATCH 5/5] Change the rest of the code to use the Git::SVN and Git::SVN::Ra url accessors.","fromName":"Michael G. Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-27T20:00:52Z","receivedAt":"2012-07-27T20:00:52Z","isPatch":true,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"From: \"Michael G. Schwern\" <schwern@pobox.com>\n\nNote: The structure returned from Git::SVN->read_all_remotes() does not appear to\ncontain objects, so I'm leaving them alone.\n\nThat's everything converted over to the url and path accessors.\n\nNo functional change.\n---\n git-svn.perl              | 11 ++++++-----\n perl/Git/SVN.pm           | 11 ++++++-----\n perl/Git/SVN/Migration.pm |  6 +++---\n 3 files changed, 15 insertions(+), 13 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 039623e..de1ddd1 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1395,7 +1395,7 @@ sub cmd_commit_diff {\n \t\t\tfatal(\"Needed URL or usable git-svn --id in \",\n \t\t\t      \"the command-line\\n\", $usage);\n \t\t}\n-\t\t$url = $gs->{url};\n+\t\t$url = $gs->url;\n \t\t$svn_path = $gs->path;\n \t}\n \tunless (defined $_revision) {\n@@ -1663,15 +1663,16 @@ sub complete_url_ls_init {\n \t\t\t      \"and a separate URL is not specified\");\n \t\t}\n \t}\n-\tmy $url = $ra->{url};\n+\tmy $url = $ra->url;\n \tmy $gs = Git::SVN->init($url, undef, undef, undef, 1);\n \tmy $k = \"svn-remote.$gs->{repo_id}.url\";\n \tmy $orig_url = eval { command_oneline(qw/config --get/, $k) };\n-\tif ($orig_url && ($orig_url ne $gs->{url})) {\n+\tif ($orig_url && ($orig_url ne $gs->url)) {\n \t\tdie \"$k already set: $orig_url\\n\",\n-\t\t    \"wanted to set to: $gs->{url}\\n\";\n+\t\t    \"wanted to set to: $gs->url\\n\";\n \t}\n-\tcommand_oneline('config', $k, $gs->{url}) unless $orig_url;\n+\tcommand_oneline('config', $k, $gs->url) unless $orig_url;\n+\n \tmy $remote_path = $gs->path . \"/$repo_path\";\n \t$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t$remote_path =~ s#/+#/#g;\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex fc907a0..7913d8f 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -560,7 +560,7 @@ sub _set_svm_vars {\n \t\t# username is of no interest\n \t\t$src =~ s{(^[a-z\\+]*://)[^/@]*@}{$1};\n \n-\t\tmy $replace = $ra->{url};\n+\t\tmy $replace = $ra->url;\n \t\t$replace .= \"/$path\" if length $path;\n \n \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n@@ -599,16 +599,17 @@ sub _set_svm_vars {\n \t$path = $ra->{svn_path};\n \t$ra = Git::SVN::Ra->new($ra->{repos_root});\n \twhile (length $path) {\n-\t\tunless ($tried{\"$ra->{url}/$path\"}) {\n+\t\tmy $try = $ra->url .\"/$path\";\n+\t\tunless ($tried{$try}) {\n \t\t\t$ok = $self->read_svm_props($ra, $path, $r);\n \t\t\tlast if $ok;\n-\t\t\t$tried{\"$ra->{url}/$path\"} = 1;\n+\t\t\t$tried{$try} = 1;\n \t\t}\n \t\t$path =~ s#/?[^/]+$##;\n \t}\n \tdie \"Path: '$path' should be ''\\n\" if $path ne '';\n \t$ok ||= $self->read_svm_props($ra, $path, $r);\n-\t$tried{\"$ra->{url}/$path\"} = 1;\n+\t$tried{$ra->url .\"/$path\"} = 1;\n \tif (!$ok) {\n \t\tdie @err, (map { \"  $_\\n\" } keys %tried), \"\\n\";\n \t}\n@@ -1108,7 +1109,7 @@ sub find_parent_branch {\n \t}\n \tmy $r = $i->{copyfrom_rev};\n \tmy $repos_root = $self->ra->{repos_root};\n-\tmy $url = $self->ra->{url};\n+\tmy $url = $self->ra->url;\n \tmy $new_url = $url . $branch_from;\n \tprint STDERR  \"Found possible branch point: \",\n \t              \"$new_url => \", $self->full_url, \", $r\\n\"\ndiff --git a/perl/Git/SVN/Migration.pm b/perl/Git/SVN/Migration.pm\nindex 75d7429..30daf35 100644\n--- a/perl/Git/SVN/Migration.pm\n+++ b/perl/Git/SVN/Migration.pm\n@@ -177,14 +177,14 @@ sub minimize_connections {\n \t\tmy $ra = Git::SVN::Ra->new($url);\n \n \t\t# skip existing cases where we already connect to the root\n-\t\tif (($ra->{url} eq $ra->{repos_root}) ||\n+\t\tif (($ra->url eq $ra->{repos_root}) ||\n \t\t    ($ra->{repos_root} eq $repo_id)) {\n-\t\t\t$root_repos->{$ra->{url}} = $repo_id;\n+\t\t\t$root_repos->{$ra->url} = $repo_id;\n \t\t\tnext;\n \t\t}\n \n \t\tmy $root_ra = Git::SVN::Ra->new($ra->{repos_root});\n-\t\tmy $root_path = $ra->{url};\n+\t\tmy $root_path = $ra->url;\n \t\t$root_path =~ s#^\\Q$ra->{repos_root}\\E(/|$)##;\n \t\tforeach my $path (keys %$fetch) {\n \t\t\tmy $ref_id = $fetch->{$path};\n-- \n1.7.11.3\n"},{"id":"195986","messageId":"20120728025912.GA28871@dcvr.yhbt.net","threadId":"31117","inReplyTo":"1343419252-9447-6-git-send-email-schwern@pobox.com","subject":"Re: [PATCH 5/5] Change the rest of the code to use the Git::SVN and Git::SVN::Ra url accessors.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-07-28T02:59:12Z","receivedAt":"2012-07-28T02:59:12Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Michael G. Schwern\" <schwern@pobox.com> wrote:\n\nWe try to keep Subject: lines short (~50 char soft limit) as documented\nin SubmittingPatches.\n\nHow about:\n\nSubject: [PATCH 4/5] use Git::SVN->path accessor globally\nSubject: [PATCH 5/5] use Git::SVN{,::RA}->url accessor globally\n\n?\n\nI can make the changes to the commit message on my side before I push\nfor Junio.\n\n> Note: The structure returned from Git::SVN->read_all_remotes() does\n> not appear to contain objects, so I'm leaving them alone.\n\nRight, just hashrefs and strings there.\n\n> No functional change.\n\nThis series looks good with minor edits.\n\nI made minor edits to reformat the new accessor subs (please do so on\nyour end before sending in the future).\n"},{"id":"195987","messageId":"20120728030959.GA3020@burratino","threadId":"31117","inReplyTo":"1343419252-9447-1-git-send-email-schwern@pobox.com","subject":"Re: Make git-svn Use accessors for paths and urls","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-07-28T03:10:43Z","receivedAt":"2012-07-28T03:10:43Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Michael G. Schwern wrote:\n\n> This is the last refactoring patch series.  After this bugs, start\n> getting fixed.\n\nI just wanted to say thanks for your thoughtful presentation of this\ncode.  I was worried before, but these have been pleasantly submitted.\n\nIf you have a chance at some point to offer advice, I'd love to add\nthe information to Documentation/SubmittingPatches that was missing.\nProposed text is ideal, but outline form or a list of missing aspects\nand confusing existing coverage would be fine, too.\n\nJonathan\n"},{"id":"195996","messageId":"50139755.7020105@pobox.com","threadId":"31117","inReplyTo":"20120728030959.GA3020@burratino","subject":"Re: Make git-svn Use accessors for paths and urls","fromName":"Michael G Schwern","fromEmail":"schwern@pobox.com","sentAt":"2012-07-28T07:40:05Z","receivedAt":"2012-07-28T07:40:05Z","isPatch":false,"sender":{"key":"schwern@pobox.com","avatar":"https://avatars.githubusercontent.com/u/25888?v=4"},"body":"On 2012.7.27 8:10 PM, Jonathan Nieder wrote:\n>> This is the last refactoring patch series.  After this bugs, start\n>> getting fixed.\n> \n> I just wanted to say thanks for your thoughtful presentation of this\n> code.  I was worried before, but these have been pleasantly submitted.\n\nYou're welcome.  I've gained at least three levels in rebasing in the process.\n\n\n> If you have a chance at some point to offer advice, I'd love to add\n> the information to Documentation/SubmittingPatches that was missing.\n> Proposed text is ideal, but outline form or a list of missing aspects\n> and confusing existing coverage would be fine, too.\n\nRemind me when I'm done with the 1.7 fix please?\n\n\n-- \nYou are wicked and wrong to have broken inside and peeked at the\nimplementation and then relied upon it.\n\t-- tchrist in <31832.969261130@chthon>\n"},{"id":"195997","messageId":"20120728075422.GA8835@burratino","threadId":"31117","inReplyTo":"50139755.7020105@pobox.com","subject":"Re: Make git-svn Use accessors for paths and urls","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-07-28T07:54:22Z","receivedAt":"2012-07-28T07:54:22Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Michael G Schwern wrote:\n> On 2012.7.27 8:10 PM, Jonathan Nieder wrote:\n\n>> If you have a chance at some point to offer advice, I'd love to add\n>> the information to Documentation/SubmittingPatches that was missing.\n[...]\n> Remind me when I'm done with the 1.7 fix please?\n\nSure, if I remember to. :)\n\nThanks,\nJonathan\n"},{"id":"199205","messageId":"20120917090435.GA358@elie.Belkin","threadId":"31117","inReplyTo":"1343419252-9447-2-git-send-email-schwern@pobox.com","subject":"Re: [PATCH 1/5] Make Git::SVN use accessors internally for path.","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-09-17T09:04:35Z","receivedAt":"2012-09-17T09:04:35Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Eric et al,\n\nMichael G. Schwern wrote:\n\n> Then later it can be canonicalized automatically rather than everywhere\n> its used.\n>\n> Later patch will make other things use it.\n\nWow am I slow.  I've finally got around to starting to parse these\npatches to apply to a 1.7.10.y tree so they can (hopefully) be part of\nDebian 7.0 when it comes out.\n\nDo I understand correctly that this patch splits logically into the\nfollowing steps?  The result is only cosmetically different from the\noriginal patch --- interdiff below the shortlog.\n\nThe completeness of the conversion to accessors is checked by renaming\nthe underlying variable in patch 5.\n\nJonathan Nieder (1):\n  Git::SVN: rename private path field\n\nMichael G. Schwern (4):\n  Git::SVN: introduce path accessor\n  Git::SVN: use accessor to read path\n  Git::SVN: use accessor to write path\n  Git::SVN::_new: use accessor to write path field\n\n git-svn.perl            |   12 +++----\n perl/Git/SVN.pm         |   84 ++++++++++++++++++++++++++++-------------------\n perl/Git/SVN/Fetcher.pm |    2 +-\n perl/Git/SVN/Ra.pm      |    8 ++---\n 4 files changed, 62 insertions(+), 44 deletions(-)\n\n---\ndiff --git c/git-svn.perl w/git-svn.perl\nindex 5711c571..af7d5308 100755\n--- c/git-svn.perl\n+++ w/git-svn.perl\n@@ -1195,7 +1195,7 @@ sub cmd_show_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:ignore'} or return;\n@@ -1211,7 +1211,7 @@ sub cmd_show_externals {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:externals'} or return;\n@@ -1226,7 +1226,7 @@ sub cmd_create_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\t# $path is of the form /path/to/dir/\n \t\t$path = '.' . $path;\n@@ -1294,7 +1294,7 @@ sub get_svnprops {\n \t$path = $cmd_dir_prefix . $path;\n \tfatal(\"No such file or directory: $path\") unless -e $path;\n \tmy $is_dir = -d $path ? 1 : 0;\n-\t$path = $gs->{path} . '/' . $path;\n+\t$path = $gs->path . '/' . $path;\n \n \t# canonicalize the path (otherwise libsvn will abort or fail to\n \t# find the file)\n@@ -1396,7 +1396,7 @@ sub cmd_commit_diff {\n \t\t\t      \"the command-line\\n\", $usage);\n \t\t}\n \t\t$url = $gs->{url};\n-\t\t$svn_path = $gs->{path};\n+\t\t$svn_path = $gs->path;\n \t}\n \tunless (defined $_revision) {\n \t\tfatal(\"-r|--revision is a required argument\\n\", $usage);\n@@ -1670,7 +1670,7 @@ sub complete_url_ls_init {\n \t\t    \"wanted to set to: $gs->{url}\\n\";\n \t}\n \tcommand_oneline('config', $k, $gs->{url}) unless $orig_url;\n-\tmy $remote_path = \"$gs->{path}/$repo_path\";\n+\tmy $remote_path = $gs->path . \"/$repo_path\";\n \t$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t$remote_path =~ s#/+#/#g;\n \t$remote_path =~ s#^/##g;\ndiff --git c/perl/Git/SVN.pm w/perl/Git/SVN.pm\nindex a93ac61b..3aa20109 100644\n--- c/perl/Git/SVN.pm\n+++ w/perl/Git/SVN.pm\n@@ -437,22 +437,19 @@ sub new {\n \t\t}\n \t}\n \tmy $self = _new($class, $repo_id, $ref_id, $path);\n-\tif (!defined $self->path || !length $self->path) {\n+\t$path = $self->path;\n+\tif (!defined $path || !length $path) {\n \t\tmy $fetch = command_oneline('config', '--get',\n \t\t                            \"svn-remote.$repo_id.fetch\",\n \t\t                            \":$ref_id\\$\") or\n \t\t     die \"Failed to read \\\"svn-remote.$repo_id.fetch\\\" \",\n \t\t         \"\\\":$ref_id\\$\\\" in config\\n\";\n-\t\tmy($path) = split(/\\s*:\\s*/, $fetch);\n-\t\t$self->path($path);\n-\t}\n-\t{\n-\t\tmy $path = $self->path;\n-\t\t$path =~ s{/+}{/}g;\n-\t\t$path =~ s{\\A/}{};\n-\t\t$path =~ s{/\\z}{};\n-\t\t$self->path($path);\n+\t\t($path, undef) = split(/\\s*:\\s*/, $fetch);\n \t}\n+\t$path =~ s{/+}{/}g;\n+\t$path =~ s{\\A/}{};\n+\t$path =~ s{/\\z}{};\n+\t$self->path($path);\n \t$self->{url} = command_oneline('config', '--get',\n \t                               \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n@@ -1059,7 +1056,7 @@ sub match_paths {\n \tif (my $path = $paths->{\"/\".$self->path}) {\n \t\treturn ($path->{action} eq 'D') ? 0 : 1;\n \t}\n-\t$self->{path_regex} ||= qr{^/\\Q@{[$self->path]}\\E/};\n+\t$self->{path_regex} ||= qr/^\\/\\Q@{[$self->path]}\\E\\//;\n \tif (grep /$self->{path_regex}/, keys %$paths) {\n \t\treturn 1;\n \t}\n@@ -1121,7 +1118,7 @@ sub find_parent_branch {\n \t\t\t($base, $head) = parse_revision_argument(0, $r);\n \t\t} else {\n \t\t\tif ($r0 < $r) {\n-\t\t\t\t$gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,\n+\t\t\t\t$gs->ra->get_log([$gs->path], $r0 + 1, $r, 1,\n \t\t\t\t\t0, 1, sub { $base = $_[1] - 1 });\n \t\t\t}\n \t\t}\n@@ -1143,7 +1140,7 @@ sub find_parent_branch {\n \t\t\t# at the moment), so we can't rely on it\n \t\t\t$self->{last_rev} = $r0;\n \t\t\t$self->{last_commit} = $parent;\n-\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->{path});\n+\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->path);\n \t\t\t$gs->ra->gs_do_switch($r0, $rev, $gs,\n \t\t\t\t\t      $self->full_url, $ed)\n \t\t\t  or die \"SVN connection failed somewhere...\\n\";\n@@ -2287,10 +2284,7 @@ sub _new {\n \t\tref_id => $ref_id, dir => $dir, index => \"$dir/index\",\n \t        config => \"$ENV{GIT_DIR}/svn/config\",\n \t        map_root => \"$dir/.rev_map\", repo_id => $repo_id }, $class;\n-\n-\t# Ensure it gets canonicalized\n \t$obj->path($path);\n-\n \treturn $obj;\n }\n \ndiff --git c/perl/Git/SVN/Fetcher.pm w/perl/Git/SVN/Fetcher.pm\nindex 76fae9bc..046a7a2f 100644\n--- c/perl/Git/SVN/Fetcher.pm\n+++ w/perl/Git/SVN/Fetcher.pm\n@@ -83,7 +83,7 @@ sub _mark_empty_symlinks {\n \tchomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);\n \tmy ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);\n \tlocal $/ = \"\\0\";\n-\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};\n+\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->path;\n \t$pfx .= '/' if length($pfx);\n \twhile (<$ls>) {\n \t\tchomp;\ndiff --git c/perl/Git/SVN/Ra.pm w/perl/Git/SVN/Ra.pm\nindex 23ff43e8..64d00672 100644\n--- c/perl/Git/SVN/Ra.pm\n+++ w/perl/Git/SVN/Ra.pm\n@@ -246,7 +246,7 @@ sub get_commit_editor {\n sub gs_do_update {\n \tmy ($self, $rev_a, $rev_b, $gs, $editor) = @_;\n \tmy $new = ($rev_a == $rev_b);\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \n \tif ($new && -e $gs->{index}) {\n \t\tunlink $gs->{index} or die\n@@ -282,7 +282,7 @@ sub gs_do_update {\n # svn_ra_reparent didn't work before 1.4)\n sub gs_do_switch {\n \tmy ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_;\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \tmy $pool = SVN::Pool->new;\n \n \tmy $full_url = $self->{url};\n@@ -326,7 +326,7 @@ sub longest_common_path {\n \tmy $common_max = scalar @$gsv;\n \n \tforeach my $gs (@$gsv) {\n-\t\tmy @tmp = split m#/#, $gs->{path};\n+\t\tmy @tmp = split m#/#, $gs->path;\n \t\tmy $p = '';\n \t\tforeach (@tmp) {\n \t\t\t$p .= length($p) ? \"/$_\" : $_;\n@@ -407,7 +407,7 @@ sub gs_fetch_loop_common {\n \t\t}\n \t\t$SVN::Error::handler = $err_handler;\n \n-\t\tmy %exists = map { $_->{path} => $_ } @$gsv;\n+\t\tmy %exists = map { $_->path => $_ } @$gsv;\n \t\tforeach my $r (sort {$a <=> $b} keys %revs) {\n \t\t\tmy ($paths, $logged) = @{$revs{$r}};\n \n\n\n---\ndiff --git c/git-svn.perl w/git-svn.perl\nindex 5711c571..af7d5308 100755\n--- c/git-svn.perl\n+++ w/git-svn.perl\n@@ -1195,7 +1195,7 @@ sub cmd_show_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:ignore'} or return;\n@@ -1211,7 +1211,7 @@ sub cmd_show_externals {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:externals'} or return;\n@@ -1226,7 +1226,7 @@ sub cmd_create_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\t# $path is of the form /path/to/dir/\n \t\t$path = '.' . $path;\n@@ -1294,7 +1294,7 @@ sub get_svnprops {\n \t$path = $cmd_dir_prefix . $path;\n \tfatal(\"No such file or directory: $path\") unless -e $path;\n \tmy $is_dir = -d $path ? 1 : 0;\n-\t$path = $gs->{path} . '/' . $path;\n+\t$path = $gs->path . '/' . $path;\n \n \t# canonicalize the path (otherwise libsvn will abort or fail to\n \t# find the file)\n@@ -1396,7 +1396,7 @@ sub cmd_commit_diff {\n \t\t\t      \"the command-line\\n\", $usage);\n \t\t}\n \t\t$url = $gs->{url};\n-\t\t$svn_path = $gs->{path};\n+\t\t$svn_path = $gs->path;\n \t}\n \tunless (defined $_revision) {\n \t\tfatal(\"-r|--revision is a required argument\\n\", $usage);\n@@ -1670,7 +1670,7 @@ sub complete_url_ls_init {\n \t\t    \"wanted to set to: $gs->{url}\\n\";\n \t}\n \tcommand_oneline('config', $k, $gs->{url}) unless $orig_url;\n-\tmy $remote_path = \"$gs->{path}/$repo_path\";\n+\tmy $remote_path = $gs->path . \"/$repo_path\";\n \t$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t$remote_path =~ s#/+#/#g;\n \t$remote_path =~ s#^/##g;\ndiff --git c/perl/Git/SVN.pm w/perl/Git/SVN.pm\nindex a93ac61b..3aa20109 100644\n--- c/perl/Git/SVN.pm\n+++ w/perl/Git/SVN.pm\n@@ -437,22 +437,19 @@ sub new {\n \t\t}\n \t}\n \tmy $self = _new($class, $repo_id, $ref_id, $path);\n-\tif (!defined $self->path || !length $self->path) {\n+\t$path = $self->path;\n+\tif (!defined $path || !length $path) {\n \t\tmy $fetch = command_oneline('config', '--get',\n \t\t                            \"svn-remote.$repo_id.fetch\",\n \t\t                            \":$ref_id\\$\") or\n \t\t     die \"Failed to read \\\"svn-remote.$repo_id.fetch\\\" \",\n \t\t         \"\\\":$ref_id\\$\\\" in config\\n\";\n-\t\tmy($path) = split(/\\s*:\\s*/, $fetch);\n-\t\t$self->path($path);\n-\t}\n-\t{\n-\t\tmy $path = $self->path;\n-\t\t$path =~ s{/+}{/}g;\n-\t\t$path =~ s{\\A/}{};\n-\t\t$path =~ s{/\\z}{};\n-\t\t$self->path($path);\n+\t\t($path, undef) = split(/\\s*:\\s*/, $fetch);\n \t}\n+\t$path =~ s{/+}{/}g;\n+\t$path =~ s{\\A/}{};\n+\t$path =~ s{/\\z}{};\n+\t$self->path($path);\n \t$self->{url} = command_oneline('config', '--get',\n \t                               \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n@@ -1059,7 +1056,7 @@ sub match_paths {\n \tif (my $path = $paths->{\"/\".$self->path}) {\n \t\treturn ($path->{action} eq 'D') ? 0 : 1;\n \t}\n-\t$self->{path_regex} ||= qr{^/\\Q@{[$self->path]}\\E/};\n+\t$self->{path_regex} ||= qr/^\\/\\Q@{[$self->path]}\\E\\//;\n \tif (grep /$self->{path_regex}/, keys %$paths) {\n \t\treturn 1;\n \t}\n@@ -1121,7 +1118,7 @@ sub find_parent_branch {\n \t\t\t($base, $head) = parse_revision_argument(0, $r);\n \t\t} else {\n \t\t\tif ($r0 < $r) {\n-\t\t\t\t$gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,\n+\t\t\t\t$gs->ra->get_log([$gs->path], $r0 + 1, $r, 1,\n \t\t\t\t\t0, 1, sub { $base = $_[1] - 1 });\n \t\t\t}\n \t\t}\n@@ -1143,7 +1140,7 @@ sub find_parent_branch {\n \t\t\t# at the moment), so we can't rely on it\n \t\t\t$self->{last_rev} = $r0;\n \t\t\t$self->{last_commit} = $parent;\n-\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->{path});\n+\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->path);\n \t\t\t$gs->ra->gs_do_switch($r0, $rev, $gs,\n \t\t\t\t\t      $self->full_url, $ed)\n \t\t\t  or die \"SVN connection failed somewhere...\\n\";\n@@ -2287,10 +2284,7 @@ sub _new {\n \t\tref_id => $ref_id, dir => $dir, index => \"$dir/index\",\n \t        config => \"$ENV{GIT_DIR}/svn/config\",\n \t        map_root => \"$dir/.rev_map\", repo_id => $repo_id }, $class;\n-\n-\t# Ensure it gets canonicalized\n \t$obj->path($path);\n-\n \treturn $obj;\n }\n \ndiff --git c/perl/Git/SVN/Fetcher.pm w/perl/Git/SVN/Fetcher.pm\nindex 76fae9bc..046a7a2f 100644\n--- c/perl/Git/SVN/Fetcher.pm\n+++ w/perl/Git/SVN/Fetcher.pm\n@@ -83,7 +83,7 @@ sub _mark_empty_symlinks {\n \tchomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);\n \tmy ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);\n \tlocal $/ = \"\\0\";\n-\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};\n+\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->path;\n \t$pfx .= '/' if length($pfx);\n \twhile (<$ls>) {\n \t\tchomp;\ndiff --git c/perl/Git/SVN/Ra.pm w/perl/Git/SVN/Ra.pm\nindex 23ff43e8..64d00672 100644\n--- c/perl/Git/SVN/Ra.pm\n+++ w/perl/Git/SVN/Ra.pm\n@@ -246,7 +246,7 @@ sub get_commit_editor {\n sub gs_do_update {\n \tmy ($self, $rev_a, $rev_b, $gs, $editor) = @_;\n \tmy $new = ($rev_a == $rev_b);\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \n \tif ($new && -e $gs->{index}) {\n \t\tunlink $gs->{index} or die\n@@ -282,7 +282,7 @@ sub gs_do_update {\n # svn_ra_reparent didn't work before 1.4)\n sub gs_do_switch {\n \tmy ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_;\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \tmy $pool = SVN::Pool->new;\n \n \tmy $full_url = $self->{url};\n@@ -326,7 +326,7 @@ sub longest_common_path {\n \tmy $common_max = scalar @$gsv;\n \n \tforeach my $gs (@$gsv) {\n-\t\tmy @tmp = split m#/#, $gs->{path};\n+\t\tmy @tmp = split m#/#, $gs->path;\n \t\tmy $p = '';\n \t\tforeach (@tmp) {\n \t\t\t$p .= length($p) ? \"/$_\" : $_;\n@@ -407,7 +407,7 @@ sub gs_fetch_loop_common {\n \t\t}\n \t\t$SVN::Error::handler = $err_handler;\n \n-\t\tmy %exists = map { $_->{path} => $_ } @$gsv;\n+\t\tmy %exists = map { $_->path => $_ } @$gsv;\n \t\tforeach my $r (sort {$a <=> $b} keys %revs) {\n \t\t\tmy ($paths, $logged) = @{$revs{$r}};\n \n"},{"id":"199206","messageId":"20120917090820.GB358@elie.Belkin","threadId":"31117","inReplyTo":"20120917090435.GA358@elie.Belkin","subject":"[FYI/PATCH 1/5] Git::SVN: introduce path accessor","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-09-17T09:08:20Z","receivedAt":"2012-09-17T09:08:20Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: Michael G. Schwern <schwern@pobox.com>\nDate: Fri, 27 Jul 2012 13:00:48 -0700\n\nEach Git::SVN handle has a (base) URL and a (relative) path pointing\nto the top-level directory of the branch it handles.  Introduce a\ngetter and setter for the path as preparation for automatically\ncanonicalizing it when reading or writing.\n\nFor example, instead of\n\n\t$oldpath = $gs->{path};\n\t$gs->{path} = $url;\n\t$gs->{path} =~ s!^\\Q$min_url\\E(/|$)!!;\n\nnow you can write\n\n\t$oldpath = $gs->path;\n\t$url =~ s!^\\Q$min_url\\E(/|$)!!;\n\t$gs->path($url);\n\n[jn: split from a larger patch]\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n perl/Git/SVN.pm |   12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex b8b34744..268e0e84 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -2282,6 +2282,18 @@ sub _new {\n \t        map_root => \"$dir/.rev_map\", repo_id => $repo_id }, $class;\n }\n \n+sub path {\n+\tmy $self = shift;\n+\n+\tif (@_) {\n+\t\tmy $path = shift;\n+\t\t$self->{path} = $path;\n+\t\treturn;\n+\t}\n+\n+\treturn $self->{path};\n+}\n+\n # for read-only access of old .rev_db formats\n sub unlink_rev_db_symlink {\n \tmy ($self) = @_;\n-- \n1.7.10.4\n"},{"id":"199207","messageId":"20120917090922.GC358@elie.Belkin","threadId":"31117","inReplyTo":"20120917090435.GA358@elie.Belkin","subject":"[FYI/PATCH 2/5] Git::SVN: use accessor to read path","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-09-17T09:09:22Z","receivedAt":"2012-09-17T09:09:22Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: Michael G. Schwern <schwern@pobox.com>\nDate: Fri, 27 Jul 2012 13:00:48 -0700\n\nThis patch only touches the simplest cases that simply read the\nGit::SVN field rather than assigning to or applying a substitution to\nit.\n\nCode to change found by searching for the term {path}.\n\n[jn: extracted from a larger patch]\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n git-svn.perl            |   12 ++++++------\n perl/Git/SVN.pm         |   44 ++++++++++++++++++++++----------------------\n perl/Git/SVN/Fetcher.pm |    2 +-\n perl/Git/SVN/Ra.pm      |    8 ++++----\n 4 files changed, 33 insertions(+), 33 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 5711c571..af7d5308 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1195,7 +1195,7 @@ sub cmd_show_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:ignore'} or return;\n@@ -1211,7 +1211,7 @@ sub cmd_show_externals {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\tprint STDOUT \"\\n# $path\\n\";\n \t\tmy $s = $props->{'svn:externals'} or return;\n@@ -1226,7 +1226,7 @@ sub cmd_create_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n-\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t$gs->prop_walk($gs->path, $r, sub {\n \t\tmy ($gs, $path, $props) = @_;\n \t\t# $path is of the form /path/to/dir/\n \t\t$path = '.' . $path;\n@@ -1294,7 +1294,7 @@ sub get_svnprops {\n \t$path = $cmd_dir_prefix . $path;\n \tfatal(\"No such file or directory: $path\") unless -e $path;\n \tmy $is_dir = -d $path ? 1 : 0;\n-\t$path = $gs->{path} . '/' . $path;\n+\t$path = $gs->path . '/' . $path;\n \n \t# canonicalize the path (otherwise libsvn will abort or fail to\n \t# find the file)\n@@ -1396,7 +1396,7 @@ sub cmd_commit_diff {\n \t\t\t      \"the command-line\\n\", $usage);\n \t\t}\n \t\t$url = $gs->{url};\n-\t\t$svn_path = $gs->{path};\n+\t\t$svn_path = $gs->path;\n \t}\n \tunless (defined $_revision) {\n \t\tfatal(\"-r|--revision is a required argument\\n\", $usage);\n@@ -1670,7 +1670,7 @@ sub complete_url_ls_init {\n \t\t    \"wanted to set to: $gs->{url}\\n\";\n \t}\n \tcommand_oneline('config', $k, $gs->{url}) unless $orig_url;\n-\tmy $remote_path = \"$gs->{path}/$repo_path\";\n+\tmy $remote_path = $gs->path . \"/$repo_path\";\n \t$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t$remote_path =~ s#/+#/#g;\n \t$remote_path =~ s#^/##g;\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 268e0e84..02d5abc0 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -314,7 +314,7 @@ sub init_remote_config {\n \t\t\t\tprint STDERR \"Using higher level of URL: \",\n \t\t\t\t\t     \"$url => $min_url\\n\";\n \t\t\t}\n-\t\t\tmy $old_path = $self->{path};\n+\t\t\tmy $old_path = $self->path;\n \t\t\t$self->{path} = $url;\n \t\t\t$self->{path} =~ s!^\\Q$min_url\\E(/|$)!!;\n \t\t\tif (length $old_path) {\n@@ -347,7 +347,7 @@ sub init_remote_config {\n \t\t$self->{path} =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n \t\tcommand_noisy('config', '--add',\n \t\t\t      \"svn-remote.$self->{repo_id}.fetch\",\n-\t\t\t      \"$self->{path}:\".$self->refname);\n+\t\t\t      $self->path.\":\".$self->refname);\n \t}\n \t$self->{url} = $url;\n }\n@@ -435,7 +435,7 @@ sub new {\n \t\t}\n \t}\n \tmy $self = _new($class, $repo_id, $ref_id, $path);\n-\tif (!defined $self->{path} || !length $self->{path}) {\n+\tif (!defined $self->path || !length $self->path) {\n \t\tmy $fetch = command_oneline('config', '--get',\n \t\t                            \"svn-remote.$repo_id.fetch\",\n \t\t                            \":$ref_id\\$\") or\n@@ -567,7 +567,7 @@ sub _set_svm_vars {\n \t}\n \n \tmy $r = $ra->get_latest_revnum;\n-\tmy $path = $self->{path};\n+\tmy $path = $self->path;\n \tmy %tried;\n \twhile (length $path) {\n \t\tunless ($tried{\"$self->{url}/$path\"}) {\n@@ -728,7 +728,7 @@ sub prop_walk {\n \t$path =~ s#^/*#/#g;\n \tmy $p = $path;\n \t# Strip the irrelevant part of the path.\n-\t$p =~ s#^/+\\Q$self->{path}\\E(/|$)#/#;\n+\t$p =~ s#^/+\\Q@{[$self->path]}\\E(/|$)#/#;\n \t# Ensure the path is terminated by a `/'.\n \t$p =~ s#/*$#/#;\n \n@@ -749,7 +749,7 @@ sub prop_walk {\n \n \tforeach (sort keys %$dirent) {\n \t\tnext if $dirent->{$_}->{kind} != $SVN::Node::dir;\n-\t\t$self->prop_walk($self->{path} . $p . $_, $rev, $sub);\n+\t\t$self->prop_walk($self->path . $p . $_, $rev, $sub);\n \t}\n }\n \n@@ -920,19 +920,19 @@ sub rewrite_uuid {\n sub metadata_url {\n \tmy ($self) = @_;\n \t($self->rewrite_root || $self->{url}) .\n-\t   (length $self->{path} ? '/' . $self->{path} : '');\n+\t   (length $self->path ? '/' . $self->path : '');\n }\n \n sub full_url {\n \tmy ($self) = @_;\n-\t$self->{url} . (length $self->{path} ? '/' . $self->{path} : '');\n+\t$self->{url} . (length $self->path ? '/' . $self->path : '');\n }\n \n sub full_pushurl {\n \tmy ($self) = @_;\n \tif ($self->{pushurl}) {\n-\t\treturn $self->{pushurl} . (length $self->{path} ? '/' .\n-\t\t       $self->{path} : '');\n+\t\treturn $self->{pushurl} . (length $self->path ? '/' .\n+\t\t       $self->path : '');\n \t} else {\n \t\treturn $self->full_url;\n \t}\n@@ -1048,20 +1048,20 @@ sub do_git_commit {\n \n sub match_paths {\n \tmy ($self, $paths, $r) = @_;\n-\treturn 1 if $self->{path} eq '';\n-\tif (my $path = $paths->{\"/$self->{path}\"}) {\n+\treturn 1 if $self->path eq '';\n+\tif (my $path = $paths->{\"/\".$self->path}) {\n \t\treturn ($path->{action} eq 'D') ? 0 : 1;\n \t}\n-\t$self->{path_regex} ||= qr/^\\/\\Q$self->{path}\\E\\//;\n+\t$self->{path_regex} ||= qr/^\\/\\Q@{[$self->path]}\\E\\//;\n \tif (grep /$self->{path_regex}/, keys %$paths) {\n \t\treturn 1;\n \t}\n \tmy $c = '';\n-\tforeach (split m#/#, $self->{path}) {\n+\tforeach (split m#/#, $self->path) {\n \t\t$c .= \"/$_\";\n \t\tnext unless ($paths->{$c} &&\n \t\t             ($paths->{$c}->{action} =~ /^[AR]$/));\n-\t\tif ($self->ra->check_path($self->{path}, $r) ==\n+\t\tif ($self->ra->check_path($self->path, $r) ==\n \t\t    $SVN::Node::dir) {\n \t\t\treturn 1;\n \t\t}\n@@ -1075,14 +1075,14 @@ sub find_parent_branch {\n \tunless (defined $paths) {\n \t\tmy $err_handler = $SVN::Error::handler;\n \t\t$SVN::Error::handler = \\&Git::SVN::Ra::skip_unknown_revs;\n-\t\t$self->ra->get_log([$self->{path}], $rev, $rev, 0, 1, 1,\n+\t\t$self->ra->get_log([$self->path], $rev, $rev, 0, 1, 1,\n \t\t\t\t   sub { $paths = $_[0] });\n \t\t$SVN::Error::handler = $err_handler;\n \t}\n \treturn undef unless defined $paths;\n \n \t# look for a parent from another branch:\n-\tmy @b_path_components = split m#/#, $self->{path};\n+\tmy @b_path_components = split m#/#, $self->path;\n \tmy @a_path_components;\n \tmy $i;\n \twhile (@b_path_components) {\n@@ -1114,7 +1114,7 @@ sub find_parent_branch {\n \t\t\t($base, $head) = parse_revision_argument(0, $r);\n \t\t} else {\n \t\t\tif ($r0 < $r) {\n-\t\t\t\t$gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,\n+\t\t\t\t$gs->ra->get_log([$gs->path], $r0 + 1, $r, 1,\n \t\t\t\t\t0, 1, sub { $base = $_[1] - 1 });\n \t\t\t}\n \t\t}\n@@ -1136,7 +1136,7 @@ sub find_parent_branch {\n \t\t\t# at the moment), so we can't rely on it\n \t\t\t$self->{last_rev} = $r0;\n \t\t\t$self->{last_commit} = $parent;\n-\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->{path});\n+\t\t\t$ed = Git::SVN::Fetcher->new($self, $gs->path);\n \t\t\t$gs->ra->gs_do_switch($r0, $rev, $gs,\n \t\t\t\t\t      $self->full_url, $ed)\n \t\t\t  or die \"SVN connection failed somewhere...\\n\";\n@@ -1235,7 +1235,7 @@ sub mkemptydirs {\n \t\tclose $fh;\n \t}\n \n-\tmy $strip = qr/\\A\\Q$self->{path}\\E(?:\\/|$)/;\n+\tmy $strip = qr/\\A\\Q@{[$self->path]}\\E(?:\\/|$)/;\n \tforeach my $d (sort keys %empty_dirs) {\n \t\t$d = uri_decode($d);\n \t\t$d =~ s/$strip//;\n@@ -1858,7 +1858,7 @@ sub make_log_entry {\n \t\t$commit_email ||= \"$author\\@$uuid\";\n \t} elsif ($self->use_svnsync_props) {\n \t\tmy $full_url = $self->svnsync->{url};\n-\t\t$full_url .= \"/$self->{path}\" if length $self->{path};\n+\t\t$full_url .= \"/\".$self->path if length $self->path;\n \t\tremove_username($full_url);\n \t\tmy $uuid = $self->svnsync->{uuid};\n \t\t$log_entry{metadata} = \"$full_url\\@$rev $uuid\";\n@@ -1905,7 +1905,7 @@ sub set_tree {\n \t                tree_b => $tree,\n \t                editor_cb => sub {\n \t\t\t       $self->set_tree_cb($log_entry, $tree, @_) },\n-\t                svn_path => $self->{path} );\n+\t                svn_path => $self->path );\n \tif (!Git::SVN::Editor->new(\\%ed_opts)->apply_diff) {\n \t\tprint \"No changes\\nr$self->{last_rev} = $tree\\n\";\n \t}\ndiff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm\nindex 76fae9bc..046a7a2f 100644\n--- a/perl/Git/SVN/Fetcher.pm\n+++ b/perl/Git/SVN/Fetcher.pm\n@@ -83,7 +83,7 @@ sub _mark_empty_symlinks {\n \tchomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);\n \tmy ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);\n \tlocal $/ = \"\\0\";\n-\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};\n+\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->path;\n \t$pfx .= '/' if length($pfx);\n \twhile (<$ls>) {\n \t\tchomp;\ndiff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm\nindex 23ff43e8..64d00672 100644\n--- a/perl/Git/SVN/Ra.pm\n+++ b/perl/Git/SVN/Ra.pm\n@@ -246,7 +246,7 @@ sub get_commit_editor {\n sub gs_do_update {\n \tmy ($self, $rev_a, $rev_b, $gs, $editor) = @_;\n \tmy $new = ($rev_a == $rev_b);\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \n \tif ($new && -e $gs->{index}) {\n \t\tunlink $gs->{index} or die\n@@ -282,7 +282,7 @@ sub gs_do_update {\n # svn_ra_reparent didn't work before 1.4)\n sub gs_do_switch {\n \tmy ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_;\n-\tmy $path = $gs->{path};\n+\tmy $path = $gs->path;\n \tmy $pool = SVN::Pool->new;\n \n \tmy $full_url = $self->{url};\n@@ -326,7 +326,7 @@ sub longest_common_path {\n \tmy $common_max = scalar @$gsv;\n \n \tforeach my $gs (@$gsv) {\n-\t\tmy @tmp = split m#/#, $gs->{path};\n+\t\tmy @tmp = split m#/#, $gs->path;\n \t\tmy $p = '';\n \t\tforeach (@tmp) {\n \t\t\t$p .= length($p) ? \"/$_\" : $_;\n@@ -407,7 +407,7 @@ sub gs_fetch_loop_common {\n \t\t}\n \t\t$SVN::Error::handler = $err_handler;\n \n-\t\tmy %exists = map { $_->{path} => $_ } @$gsv;\n+\t\tmy %exists = map { $_->path => $_ } @$gsv;\n \t\tforeach my $r (sort {$a <=> $b} keys %revs) {\n \t\t\tmy ($paths, $logged) = @{$revs{$r}};\n \n-- \n1.7.10.4\n"},{"id":"199208","messageId":"20120917091053.GD358@elie.Belkin","threadId":"31117","inReplyTo":"20120917090435.GA358@elie.Belkin","subject":"[FYI/PATCH 3/5] Git::SVN: use accessor to write path","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-09-17T09:10:53Z","receivedAt":"2012-09-17T09:10:53Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: Michael G. Schwern <schwern@pobox.com>\nDate: Fri, 27 Jul 2012 13:00:48 -0700\n\nThis patch only touches cases where the path field is written to using\n$gs->{path}.  Cases where the path is set directly in a hash literal\nwill be addressed separately.\n\n[jn: split from a larger patch]\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n perl/Git/SVN.pm |   24 ++++++++++++++----------\n 1 file changed, 14 insertions(+), 10 deletions(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 02d5abc0..826a7fa6 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -315,11 +315,11 @@ sub init_remote_config {\n \t\t\t\t\t     \"$url => $min_url\\n\";\n \t\t\t}\n \t\t\tmy $old_path = $self->path;\n-\t\t\t$self->{path} = $url;\n-\t\t\t$self->{path} =~ s!^\\Q$min_url\\E(/|$)!!;\n+\t\t\t$url =~ s!^\\Q$min_url\\E(/|$)!!;\n \t\t\tif (length $old_path) {\n-\t\t\t\t$self->{path} .= \"/$old_path\";\n+\t\t\t\t$url .= \"/$old_path\";\n \t\t\t}\n+\t\t\t$self->path($url);\n \t\t\t$url = $min_url;\n \t\t}\n \t}\n@@ -343,8 +343,10 @@ sub init_remote_config {\n \tunless ($no_write) {\n \t\tcommand_noisy('config',\n \t\t\t      \"svn-remote.$self->{repo_id}.url\", $url);\n-\t\t$self->{path} =~ s{^/}{};\n-\t\t$self->{path} =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n+\t\tmy $path = $self->path;\n+\t\t$path =~ s{^/}{};\n+\t\t$path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;\n+\t\t$self->path($path);\n \t\tcommand_noisy('config', '--add',\n \t\t\t      \"svn-remote.$self->{repo_id}.fetch\",\n \t\t\t      $self->path.\":\".$self->refname);\n@@ -435,17 +437,19 @@ sub new {\n \t\t}\n \t}\n \tmy $self = _new($class, $repo_id, $ref_id, $path);\n-\tif (!defined $self->path || !length $self->path) {\n+\t$path = $self->path;\n+\tif (!defined $path || !length $path) {\n \t\tmy $fetch = command_oneline('config', '--get',\n \t\t                            \"svn-remote.$repo_id.fetch\",\n \t\t                            \":$ref_id\\$\") or\n \t\t     die \"Failed to read \\\"svn-remote.$repo_id.fetch\\\" \",\n \t\t         \"\\\":$ref_id\\$\\\" in config\\n\";\n-\t\t($self->{path}, undef) = split(/\\s*:\\s*/, $fetch);\n+\t\t($path, undef) = split(/\\s*:\\s*/, $fetch);\n \t}\n-\t$self->{path} =~ s{/+}{/}g;\n-\t$self->{path} =~ s{\\A/}{};\n-\t$self->{path} =~ s{/\\z}{};\n+\t$path =~ s{/+}{/}g;\n+\t$path =~ s{\\A/}{};\n+\t$path =~ s{/\\z}{};\n+\t$self->path($path);\n \t$self->{url} = command_oneline('config', '--get',\n \t                               \"svn-remote.$repo_id.url\") or\n                   die \"Failed to read \\\"svn-remote.$repo_id.url\\\" in config\\n\";\n-- \n1.7.10.4\n"},{"id":"199209","messageId":"20120917091234.GE358@elie.Belkin","threadId":"31117","inReplyTo":"20120917090435.GA358@elie.Belkin","subject":"[FYI/PATCH 4/5] Git::SVN::_new: use accessor to write path field","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-09-17T09:12:34Z","receivedAt":"2012-09-17T09:12:34Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"From: Michael G. Schwern <schwern@pobox.com>\nDate: Fri, 27 Jul 2012 13:00:48 -0700\n\nIf some day the setter is taught to canonicalize paths, make sure the\npath gets canonicalized at construction time, too.\n\n[jn: split from a larger patch]\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n perl/Git/SVN.pm |    6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 826a7fa6..3aa20109 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -2280,10 +2280,12 @@ sub _new {\n \n \t$_[3] = $path = '' unless (defined $path);\n \tmkpath([$dir]);\n-\tbless {\n+\tmy $obj = bless {\n \t\tref_id => $ref_id, dir => $dir, index => \"$dir/index\",\n-\t        path => $path, config => \"$ENV{GIT_DIR}/svn/config\",\n+\t        config => \"$ENV{GIT_DIR}/svn/config\",\n \t        map_root => \"$dir/.rev_map\", repo_id => $repo_id }, $class;\n+\t$obj->path($path);\n+\treturn $obj;\n }\n \n sub path {\n-- \n1.7.10.4\n"},{"id":"199210","messageId":"20120917091331.GF358@elie.Belkin","threadId":"31117","inReplyTo":"20120917090435.GA358@elie.Belkin","subject":"[PATCH/RFC 5/5] Git::SVN: rename private path field","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-09-17T09:13:31Z","receivedAt":"2012-09-17T09:13:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"All users of $gs->{path} should have been converted to use the\naccessor by now.  Check our work by renaming the underlying variable\nto break callers that try to use it directly.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n perl/Git/SVN.pm |    4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 3aa20109..33f15682 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -2293,11 +2293,11 @@ sub path {\n \n \tif (@_) {\n \t\tmy $path = shift;\n-\t\t$self->{path} = $path;\n+\t\t$self->{_path} = $path;\n \t\treturn;\n \t}\n \n-\treturn $self->{path};\n+\treturn $self->{_path};\n }\n \n # for read-only access of old .rev_db formats\n-- \n1.7.10.4\n"},{"id":"199309","messageId":"7vboh4qjwo.fsf@alter.siamese.dyndns.org","threadId":"31117","inReplyTo":"20120917091331.GF358@elie.Belkin","subject":"Re: [PATCH/RFC 5/5] Git::SVN: rename private path field","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-18T00:00:55Z","receivedAt":"2012-09-18T00:00:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> All users of $gs->{path} should have been converted to use the\n> accessor by now.  Check our work by renaming the underlying variable\n> to break callers that try to use it directly.\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n\nI like this ;-)  If we know we have good coverage, this would be a\nsensible way to catch remaining code that hasn't been converted.\n\n>  perl/Git/SVN.pm |    4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\n> index 3aa20109..33f15682 100644\n> --- a/perl/Git/SVN.pm\n> +++ b/perl/Git/SVN.pm\n> @@ -2293,11 +2293,11 @@ sub path {\n>  \n>  \tif (@_) {\n>  \t\tmy $path = shift;\n> -\t\t$self->{path} = $path;\n> +\t\t$self->{_path} = $path;\n>  \t\treturn;\n>  \t}\n>  \n> -\treturn $self->{path};\n> +\treturn $self->{_path};\n>  }\n>  \n>  # for read-only access of old .rev_db formats\n"},{"id":"199310","messageId":"20120918000737.GA17939@dcvr.yhbt.net","threadId":"31117","inReplyTo":"20120917091331.GF358@elie.Belkin","subject":"Re: [PATCH/RFC 5/5] Git::SVN: rename private path field","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-09-18T00:07:37Z","receivedAt":"2012-09-18T00:07:37Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Jonathan Nieder <jrnieder@gmail.com> wrote:\n> All users of $gs->{path} should have been converted to use the\n> accessor by now.  Check our work by renaming the underlying variable\n> to break callers that try to use it directly.\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n\nI think this is a good patch for master, too.  Thanks.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n> ---\n>  perl/Git/SVN.pm |    4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> -- \n\nI'll apply the following (on top of a patch which fixes some\n{path} usages):\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 88b9164..59215fa 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -2331,11 +2331,11 @@ sub path {\n \n \tif (@_) {\n \t\tmy $path = shift;\n-\t\t$self->{path} = canonicalize_path($path);\n+\t\t$self->{_path} = canonicalize_path($path);\n \t\treturn;\n \t}\n \n-\treturn $self->{path};\n+\treturn $self->{_path};\n }\n \n sub url {\n"}]}