]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Git.pm
v2writable: initial cut for repo-rotation
[public-inbox.git] / lib / PublicInbox / Git.pm
index ea2b814e398b2a9bd944a0a82155b866cf43da53..6437643d88fb9840c69cce1a3784ab48ab6ca711 100644 (file)
@@ -139,6 +139,18 @@ sub cleanup {
        _destroy($self, qw(in_c out_c pid_c));
 }
 
+# assuming a well-maintained repo, this should be a somewhat
+# accurate estimation of its size
+# TODO: show this in the WWW UI as a hint to potential cloners
+sub packed_bytes {
+       my ($self) = @_;
+       my $n = 0;
+       foreach my $p (glob("$self->{git_dir}/objects/pack/*.pack")) {
+               $n += -s $p;
+       }
+       $n
+}
+
 sub DESTROY { cleanup(@_) }
 
 1;