@matheusbsbs / matheus-bagliano / commits / 6c5cda89e9
Fork 0

git-svn: avoid creating some small files

repo_path_split() is already pretty fast, and is already optimized via caching. We also don't need to create an exclude file if we're relying on the SVN libraries. Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Jun 14, 2006 at 21:24 UTC 6c5cda89e93915ed2984ba560f3c3d048c7a5702
1 file changed +8 -18
contrib/git-svn/git-svn.perl
+8 -18
@@ -1005,12 +1005,6 @@ sub setup_git_svn {
1005 close $fh;
1006 s_to_file($SVN_URL,"$GIT_SVN_DIR/info/url");
1007
1008 - open my $fd, '>>', "$GIT_SVN_DIR/info/exclude" or croak $!;
1009 - print $fd '.svn',"\n";
1010 - close $fd or croak $!;
1011 - my ($url, $path) = repo_path_split($SVN_URL);
1012 - s_to_file($url, "$GIT_SVN_DIR/info/repo_url");
1013 - s_to_file($path, "$GIT_SVN_DIR/info/repo_path");
1008 }
1009
1010 sub assert_svn_wc_clean {
@@ -1649,6 +1643,12 @@ sub do_update_index {
1643
1644 sub index_changes {
1645 return if $_use_lib;
1646 +
1647 + if (!-f "$GIT_SVN_DIR/info/exclude") {
1648 + open my $fd, '>>', "$GIT_SVN_DIR/info/exclude" or croak $!;
1649 + print $fd '.svn',"\n";
1650 + close $fd or croak $!;
1651 + }
1652 my $no_text_base = shift;
1653 do_update_index([qw/git-diff-files --name-only -z/],
1654 'remove',
@@ -2018,9 +2018,6 @@ sub migration_check {
2018 my $dn = dirname("$GIT_DIR/svn/$x");
2019 mkpath([$dn]) unless -d $dn;
2020 rename "$GIT_DIR/$x", "$GIT_DIR/svn/$x" or croak "$!: $x";
2021 - my ($url, $path) = repo_path_split($u);
2022 - s_to_file($url, "$GIT_DIR/svn/$x/info/repo_url");
2023 - s_to_file($path, "$GIT_DIR/svn/$x/info/repo_path");
2021 }
2022 migrate_revdb() if (-d $GIT_SVN_DIR && !-w $REVDB);
2023 print "Done upgrading.\n";
@@ -2138,15 +2135,8 @@ sub write_grafts {
2135 sub read_url_paths {
2136 my $l_map = {};
2137 git_svn_each(sub { my $x = shift;
2141 - my $u = file_to_s("$GIT_DIR/svn/$x/info/repo_url");
2142 - my $p = file_to_s("$GIT_DIR/svn/$x/info/repo_path");
2143 - # we hate trailing slashes
2144 - if ($u =~ s#(?:^\/+|\/+$)##g) {
2145 - s_to_file($u,"$GIT_DIR/svn/$x/info/repo_url");
2146 - }
2147 - if ($p =~ s#(?:^\/+|\/+$)##g) {
2148 - s_to_file($p,"$GIT_DIR/svn/$x/info/repo_path");
2149 - }
2138 + my $url = file_to_s("$GIT_DIR/svn/$x/info/url");
2139 + my ($u, $p) = repo_path_split($url);
2140 $l_map->{$u}->{$p} = $x;
2141 });
2142 return $l_map;