git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] git-svn: avoid creating some small files

From
EWEric Wong <normalperson@yhbt.net>
Date
Jun 15, 2006, 20:55 UTC
Message-ID
<11504049313192-git-send-email-normalperson@yhbt.net>

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>
---
 contrib/git-svn/git-svn.perl |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 884969e..88af9c5 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -1005,12 +1005,6 @@ sub setup_git_svn {
 	close $fh;
 	s_to_file($SVN_URL,"$GIT_SVN_DIR/info/url");
 
-	open my $fd, '>>', "$GIT_SVN_DIR/info/exclude" or croak $!;
-	print $fd '.svn',"\n";
-	close $fd or croak $!;
-	my ($url, $path) = repo_path_split($SVN_URL);
-	s_to_file($url, "$GIT_SVN_DIR/info/repo_url");
-	s_to_file($path, "$GIT_SVN_DIR/info/repo_path");
 }
 
 sub assert_svn_wc_clean {
@@ -1649,6 +1643,12 @@ sub do_update_index {
 
 sub index_changes {
 	return if $_use_lib;
+
+	if (!-f "$GIT_SVN_DIR/info/exclude") {
+		open my $fd, '>>', "$GIT_SVN_DIR/info/exclude" or croak $!;
+		print $fd '.svn',"\n";
+		close $fd or croak $!;
+	}
 	my $no_text_base = shift;
 	do_update_index([qw/git-diff-files --name-only -z/],
 			'remove',
@@ -2018,9 +2018,6 @@ sub migration_check {
 		my $dn = dirname("$GIT_DIR/svn/$x");
 		mkpath([$dn]) unless -d $dn;
 		rename "$GIT_DIR/$x", "$GIT_DIR/svn/$x" or croak "$!: $x";
-		my ($url, $path) = repo_path_split($u);
-		s_to_file($url, "$GIT_DIR/svn/$x/info/repo_url");
-		s_to_file($path, "$GIT_DIR/svn/$x/info/repo_path");
 	}
 	migrate_revdb() if (-d $GIT_SVN_DIR && !-w $REVDB);
 	print "Done upgrading.\n";
@@ -2138,15 +2135,8 @@ sub write_grafts {
 sub read_url_paths {
 	my $l_map = {};
 	git_svn_each(sub { my $x = shift;
-			my $u = file_to_s("$GIT_DIR/svn/$x/info/repo_url");
-			my $p = file_to_s("$GIT_DIR/svn/$x/info/repo_path");
-			# we hate trailing slashes
-			if ($u =~ s#(?:^\/+|\/+$)##g) {
-				s_to_file($u,"$GIT_DIR/svn/$x/info/repo_url");
-			}
-			if ($p =~ s#(?:^\/+|\/+$)##g) {
-				s_to_file($p,"$GIT_DIR/svn/$x/info/repo_path");
-			}
+			my $url = file_to_s("$GIT_DIR/svn/$x/info/url");
+			my ($u, $p) = repo_path_split($url);
 			$l_map->{$u}->{$p} = $x;
 			});
 	return $l_map;
-- 
1.4.0
Next: Eric Wong
Message 1 of 8 in “git-svn: avoid creating some small files”
  1. 1/3 git-svn: avoid creating some small filesEric Wong, Jun 15, 2006
  2. 2/3 git-svn: fix several small bugs, enable branch optimizationEric Wong, Jun 15, 2006
  3. 3/3 git-svn: Eliminate temp file usage in libsvn_get_file()Eric Wong, Jun 15, 2006
  4. 0/4 git-svn: more improvementsEric Wong, Jun 16, 2006
  5. 1/4 git-svn: bugfix and optimize the 'log' commandEric Wong, Jun 16, 2006
  6. 2/4 git-svn: tests no longer fail if LC_ALL is not a UTF-8 localeEric Wong, Jun 16, 2006
  7. 3/4 git-svn: svn (command-line) 1.0.x compatibilityEric Wong, Jun 16, 2006
  8. 4/4 git-svn: rebuild convenience and bugfixesEric Wong, Jun 16, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.