aboutsummaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-01-31 17:31:12 -0800
committerEric Wong <normalperson@yhbt.net>2009-02-11 02:00:42 -0800
commit4c58a7111d9fb4f62ca041fc73e8aec0a2f9c800 (patch)
tree98e6180b27c1c00c169168842a2d72ecba41ba0f /git-svn.perl
parent1b53a076fc3e3dc58e67971df18df0ce973a3ff9 (diff)
downloadgit-4c58a7111d9fb4f62ca041fc73e8aec0a2f9c800.tar.gz
git-4c58a7111d9fb4f62ca041fc73e8aec0a2f9c800.tar.xz
git-svn: allow disabling expensive broken symlink checks
Since dbc6c74d0858d77e61e092a48d467e725211f8e9, git-svn has had an expensive check for broken symlinks that exist in some repositories. This leads to a heavy performance hit on repositories with many empty blobs that are not supposed to be symlinks. The workaround is enabled by default; and may be disabled via: git config svn.brokenSymlinkWorkaround false Reported by Markus Heidelberg. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl20
1 files changed, 20 insertions, 0 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 79888a05c..bebcbdea2 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3271,10 +3271,18 @@ sub new {
# do_{switch,update}
sub _mark_empty_symlinks {
my ($git_svn) = @_;
+ my $bool = Git::config_bool('svn.brokenSymlinkWorkaround');
+ return {} if (defined($bool) && ! $bool);
+
my %ret;
my ($rev, $cmt) = $git_svn->last_rev_commit;
return {} unless ($rev && $cmt);
+ # allow the warning to be printed for each revision we fetch to
+ # ensure the user sees it. The user can also disable the workaround
+ # on the repository even while git svn is running and the next
+ # revision fetched will skip this expensive function.
+ my $printed_warning;
chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);
my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);
local $/ = "\0";
@@ -3283,6 +3291,18 @@ sub _mark_empty_symlinks {
while (<$ls>) {
chomp;
s/\A100644 blob $empty_blob\t//o or next;
+ unless ($printed_warning) {
+ print STDERR "Scanning for empty symlinks, ",
+ "this may take a while if you have ",
+ "many empty files\n",
+ "You may disable this with `",
+ "git config svn.brokenSymlinkWorkaround ",
+ "false'.\n",
+ "This may be done in a different ",
+ "terminal without restarting ",
+ "git svn\n";
+ $printed_warning = 1;
+ }
my $path = $_;
my (undef, $props) =
$git_svn->ra->get_file($pfx.$path, $rev, undef);