3 # Send a project to the trash
11 use Girocco
::Util
qw(noFatalsToBrowser);
12 BEGIN {noFatalsToBrowser
}
14 my $project = shift @ARGV || die "Please give project name on command line.";
17 # Physical removal isn't actually supported. You have to do it manually.
18 # This only deletes the project from the list.
20 if ($project eq '--really-delete') {
22 $project = shift @ARGV || die "Please give project name on command line.";
26 # Don't use this option while jobd is running. You run the risk of destroying data.
28 if ($project eq '--keep-forks') {
30 $project = shift @ARGV || die "Please give project name on command line.";
33 my $p = Girocco
::Project
->load($project) || die "Project '$project' not found!";
36 # Run GC on that repository so that objects don't get lost within forks
37 my $reporoot = $Girocco::Config
::reporoot
;
38 my $basedir = $Girocco::Config
::basedir
;
39 print "We have to run GC on the repo so that the forks don't lose data. Hang on...\n";
40 system($Girocco::Config
::git_bin
, "--git-dir=$reporoot/$project.git", 'config',
41 '--unset', 'gitweb.lastgc');
42 $ENV{'show_progress'} = 1;
43 system("$basedir/jobd/gc.sh", $project);
45 die "Complicated situation: project still has forks. Please deal with it manually."
46 if (-d
"$Girocco::Config::reporoot/$project/");
51 $archived = $p->archive_and_delete();
55 print "Project '$project' removed from $Girocco::Config::name".
56 ($delete ?
'' : ", backup in '$archived'") .".\n";