about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-06 21:12:24 +0000
committerEric Wong <e@80x24.org>2023-12-06 23:48:26 +0000
commit499ceaa18ac3fe5135f683938cb471df96e22c8b (patch)
treec5e614bcb956ef6ffa3fd4b20a9cf96e200b54dd /t
parent0ab999b988c62b701bde26a8bad2b75da0a7ac43 (diff)
downloadpublic-inbox-499ceaa18ac3fe5135f683938cb471df96e22c8b.tar.gz
Our code aims to respect $ENV{PWD} (and therefore symlinks) as
much as possible to ensure portability across devices when repos
and indices are on portable or shared storage.  Thus we can't
rely on Cwd::abs_path and ought to favor File::Spec->rel2abs
whenever absolute paths are required.

I noticed this when working on a VM where my worktree is a
symlink to a more reliable device.
Diffstat (limited to 't')
-rw-r--r--t/cindex.t5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/cindex.t b/t/cindex.t
index 716e5984..15c860e1 100644
--- a/t/cindex.t
+++ b/t/cindex.t
@@ -3,7 +3,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use v5.12;
 use PublicInbox::TestCommon;
-use Cwd qw(getcwd abs_path);
+use Cwd qw(getcwd);
 use List::Util qw(sum);
 use autodie qw(close mkdir open rename);
 require_mods(qw(json Xapian +SCM_RIGHTS));
@@ -67,6 +67,7 @@ git gc -q
 EOM
 }; # /create_coderepo
 
+$zp = File::Spec->rel2abs($zp);
 ok(run_script([qw(-cindex --dangerous -q -d), "$tmp/ext",
                 '-g', $zp, '-g', "$tmp/wt0" ]),
         'cindex external');
@@ -125,7 +126,7 @@ use_ok 'PublicInbox::CodeSearch';
 
 my @xh_args;
 my $exp = [ 'initial with NUL character', 'remove NUL character' ];
-my $zp_git = abs_path("$zp/.git");
+my $zp_git = "$zp/.git";
 if ('multi-repo search') {
         my $csrch = PublicInbox::CodeSearch->new("$tmp/ext");
         my $mset = $csrch->mset('NUL');