blob: 881ddb49575bf64480b4c748699bf55f926c0881 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env perl
use 5.036;
use Getopt::Long qw(:config pass_through);
use Scalar::Util "looks_like_number";
my $d = 30;
my ($from, $force, @args);
GetOptions "days=i" => \$d, "from=s" => \$from, "force!" => \$force;
my $s = time - $d*24*60*60;
$from and unshift @ARGV, "--from=$from";
$force and unshift @args, "--force";
system qw(git annex unused), @ARGV and die "'git annex unused' failed\n";
open my $fh, "<", ".git/annex/unused" or exit;
for (<$fh>) {
my ($n, $k) = split;
my ($t) = `git log -1 --format="%ct" --no-textconv -S"$k"`;
looks_like_number $t and $t < $s and push @args, $n
}
exec qw(git annex dropunused), @args
|