Code

core.whitespace: cr-at-eol
[git.git] / git-svn.perl
index 75e97cc72fb7906f098717797eb1ac0303ef2a19..6cc3157e229f9cc2e4604a872efad16ce27f0323 100755 (executable)
@@ -1247,7 +1247,8 @@ use File::Path qw/mkpath/;
 use File::Copy qw/copy/;
 use IPC::Open3;
 
-my $_repack_nr;
+my ($_gc_nr, $_gc_period);
+
 # properties that we do not log:
 my %SKIP_PROP;
 BEGIN {
@@ -1408,9 +1409,10 @@ sub read_all_remotes {
 }
 
 sub init_vars {
-       $_repack = 1000 unless (defined $_repack && $_repack > 0);
-       $_repack_nr = $_repack;
-       $_repack_flags ||= '-d';
+       $_gc_nr = $_gc_period = 1000;
+       if (defined $_repack || defined $_repack_flags) {
+              warn "Repack options are obsolete; they have no effect.\n";
+       }
 }
 
 sub verify_remotes_sanity {
@@ -2096,6 +2098,10 @@ sub restore_commit_header_env {
        }
 }
 
+sub gc {
+       command_noisy('gc', '--auto');
+};
+
 sub do_git_commit {
        my ($self, $log_entry) = @_;
        my $lr = $self->last_rev;
@@ -2149,12 +2155,9 @@ sub do_git_commit {
                                   0, $self->svm_uuid);
        }
        print " = $commit ($self->{ref_id})\n";
-       if ($_repack && (--$_repack_nr == 0)) {
-               $_repack_nr = $_repack;
-               # repack doesn't use any arguments with spaces in them, does it?
-               print "Running git repack $_repack_flags ...\n";
-               command_noisy('repack', split(/\s+/, $_repack_flags));
-               print "Done repacking\n";
+       if (--$_gc_nr == 0) {
+               $_gc_nr = $_gc_period;
+               gc();
        }
        return $commit;
 }
@@ -3983,6 +3986,7 @@ sub gs_fetch_loop_common {
                $max += $inc;
                $max = $head if ($max > $head);
        }
+       Git::SVN::gc();
 }
 
 sub match_globs {