# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# backend for a git-cat-file-workalike based on libgit2,
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# backend for a git-cat-file-workalike based on libgit2,
use Fcntl qw(LOCK_EX SEEK_SET);
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
use IO::Handle; # autoflush
use Fcntl qw(LOCK_EX SEEK_SET);
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
use IO::Handle; # autoflush
my $f = "$inline_dir/.public-inbox.lock";
open my $fh, '+>', $f or die "open($f): $!";
my $f = "$inline_dir/.public-inbox.lock";
open my $fh, '+>', $f or die "open($f): $!";
# retry once if missing. We only get unabbreviated OIDs
# from SQLite or Xapian DBs, here, so malicious clients
# can't trigger excessive retries:
# retry once if missing. We only get unabbreviated OIDs
# from SQLite or Xapian DBs, here, so malicious clients
# can't trigger excessive retries:
$check_at = clock_gettime(CLOCK_MONOTONIC) + $exp;
if ($gcf2->cat_oid(1, $oid)) {
$check_at = clock_gettime(CLOCK_MONOTONIC) + $exp;
if ($gcf2->cat_oid(1, $oid)) {