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

Re: "git svn mkdirs" is very slow

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 28, 2011, 17:44 UTC
Message-ID
<7vhbanywb4.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4D90A3AA.3050601@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 19 quoted lines
> So I
> wanted to implement the following feature:
>
> 1. An svn.autoMkdirs / svn-remote.<name>.autoMkdirs configuration
> variable.  The value should default to true for backwards compatibility.
>
> 2. Only call mkemptydirs() if this variable is set to true.
>
> 3. Make an exception for "git svn mkdirs", which should do its thing
> regardless of how this configuration option is set.
>
> I think it should only be about a 10-line change, plus documentation and
> tests.  Unfortunately, my perl-foo is very limited, and it will take me
> a while to figure out how option parsing and handling works in git-svn.
>
> Would this feature be welcome?
>
> Is there anybody willing to make the Perl changes?  I would be willing
> to work on the documentation and test suite changes.

Sounds like a sensible thing to do, but I wonder if we also want a command line option --automkdirs (or --auto-create-empty-directories) in %fc_opts to make it overridable from the command line. Perhaps it is not worth it.

A completely untested patch is here.
 git-svn.perl |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index a5857c1..fe4c716 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -781,6 +781,16 @@ sub cmd_find_rev {
 	print "$result\n" if $result;
 }
 
+sub auto_create_empty_directories {
+	my ($gs) = @_;
+	my $var = eval { command_oneline('config', '--get', '--bool',
+					 "svn-remote.$gs->{repo_id}.automkdirs") };
+	# By default, create empty directories by consulting the unhandled log,
+	# but allow setting it to 'false' to skip it.  I wonder if the variable
+	# should be "skip create empty directories", though...
+	return !($var && $var eq 'false');
+}
+
 sub cmd_rebase {
 	command_noisy(qw/update-index --refresh/);
 	my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
@@ -804,7 +814,9 @@ sub cmd_rebase {
 		$_fetch_all ? $gs->fetch_all : $gs->fetch;
 	}
 	command_noisy(rebase_cmd(), $gs->refname);
-	$gs->mkemptydirs;
+	if (auto_create_empty_directories($gs)) {
+		$gs->mkemptydirs;
+	}
 }
 
 sub cmd_show_ignore {
@@ -1242,7 +1254,9 @@ sub post_fetch_checkout {
 	command_noisy(qw/read-tree -m -u -v HEAD HEAD/);
 	print STDERR "Checked out HEAD:\n  ",
 	             $gs->full_url, " r", $gs->last_rev, "\n";
-	$gs->mkemptydirs($gs->last_rev);
+	if (auto_create_empty_directories($gs)) {
+		$gs->mkemptydirs($gs->last_rev);
+	}
 }
 
 sub complete_svn_url {
Previous: Michael HaggertyNext: Michael Haggerty
Message 2 of 3 in “"git svn mkdirs" is very slow”
  1. Michael HaggertyMar 28, 2011
  2. Junio C HamanoMar 28, 2011
  3. git-svn: add an option to skip the creation of empty directoriesMichael Haggerty, Apr 1, 2011

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.