unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] t/cindex: fix test when worktree PWD is a symlink
Date: Wed,  6 Dec 2023 21:12:24 +0000	[thread overview]
Message-ID: <20231206211225.2952183-2-e@80x24.org> (raw)
In-Reply-To: <20231206211225.2952183-1-e@80x24.org>

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.
---
 t/cindex.t | 5 +++--
 1 file 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');

  reply	other threads:[~2023-12-06 21:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 21:12 [PATCH 0/2] cindex bug fixes Eric Wong
2023-12-06 21:12 ` Eric Wong [this message]
2023-12-06 21:12 ` [PATCH 2/2] cindex: avoid recursion on prune Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231206211225.2952183-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).