about summary refs log tree commit homepage
path: root/lib/PublicInbox/Gcf2.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-26 10:17:13 +0000
committerEric Wong <e@80x24.org>2022-09-26 19:22:03 +0000
commit1c0ec857d041dc287919917676bb6678301085d6 (patch)
tree0b33672779ba67a53be9496ca2351c7da3971b53 /lib/PublicInbox/Gcf2.pm
parent06600f6ea9258425f4f7ff7a7b1f3d028d11b638 (diff)
downloadpublic-inbox-1c0ec857d041dc287919917676bb6678301085d6.tar.gz
We must use `git rev-parse --git-path objects' instead of
blindly appending '/objects' to $GIT_DIR, since appending
doesn't work when $GIT_DIR is a worktree.
Diffstat (limited to 'lib/PublicInbox/Gcf2.pm')
-rw-r--r--lib/PublicInbox/Gcf2.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm
index 02cd0de2..2ba2efff 100644
--- a/lib/PublicInbox/Gcf2.pm
+++ b/lib/PublicInbox/Gcf2.pm
@@ -80,7 +80,8 @@ EOM
 }
 
 sub add_alt ($$) {
-        my ($gcf2, $objdir) = @_;
+        my ($gcf2, $git_dir) = @_;
+        my $objdir = PublicInbox::Git->new($git_dir)->git_path('objects');
 
         # libgit2 (tested 0.27.7+dfsg.1-0.2 and 0.28.3+dfsg.1-1~bpo10+1
         # in Debian) doesn't handle relative epochs properly when nested
@@ -120,7 +121,7 @@ sub loop (;$) {
         while (<STDIN>) {
                 chomp;
                 my ($oid, $git_dir) = split(/ /, $_, 2);
-                $seen{$git_dir} //= add_alt($gcf2, "$git_dir/objects");
+                $seen{$git_dir} //= add_alt($gcf2, $git_dir);
                 if (!$gcf2->cat_oid(1, $oid)) {
                         # retry once if missing.  We only get unabbreviated OIDs
                         # from SQLite or Xapian DBs, here, so malicious clients
@@ -128,7 +129,7 @@ sub loop (;$) {
                         warn "I: $$ $oid missing, retrying in $git_dir\n";
 
                         $gcf2 = new();
-                        %seen = ($git_dir => add_alt($gcf2,"$git_dir/objects"));
+                        %seen = ($git_dir => add_alt($gcf2, $git_dir);
                         $check_at = clock_gettime(CLOCK_MONOTONIC) + $exp;
 
                         if ($gcf2->cat_oid(1, $oid)) {