summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-04-01 12:26:00 +0200
committerJunio C Hamano <gitster@pobox.com>2011-04-01 12:53:18 -0700
commit55f9d7a75c90ca98f7d7be32e9bdca5a789d1257 (patch)
treef947c8e7b42b39b500f3a405f5c597971cd2869f /git-svn.perl
parent6acef043581d69597860f3343ec2691c72b0803c (diff)
downloadgit-55f9d7a75c90ca98f7d7be32e9bdca5a789d1257.tar.gz
git-svn: add an option to skip the creation of empty directories
"git svn mkdirs" (which creates empty directories in the current working copy) can be very slow and is often unnecessary. Provide a config file option "svn-remote.<name>.automkdirs" that prevents empty directories from being created automatically. (They are still created if "git svn mkdirs" is invoked explicitly.) Based-on-patch-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl17
1 files changed, 15 insertions, 2 deletions
diff --git a/git-svn.perl b/git-svn.perl
index a5857c1ad4..9a9b0949f5 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -781,6 +781,15 @@ 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.
+ 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 +813,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 +1253,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 {