From 1b6ba49d9bed170e3f3932389bb70fe2b83aad91 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 26 Mar 2025 03:34:59 +0000 Subject: [PATCH] solver: use git_quote on filenames for diagnostics git_quote output makes more sense than relying on \Q..\E from Perl or even Data::Dumper since these filenames are from git output and more users are likely familiar with git-style quoting than anything Perl-specific. --- lib/PublicInbox/SolverGit.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index e30761e25..322610130 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -472,15 +472,16 @@ sub parse_ls_files ($$) { my $di = $self->{-cur_di}; my @ls = split(/\0/, $$bref); my ($line, @extra) = grep(/\t\Q$di->{path_b}\E\z/, @ls); - scalar(@extra) and die "BUG: extra files in index: <", - join('> <', $line, @extra), ">"; - $line // die "no \Q$di->{path_b}\E in <",join('> <', @ls), '>'; + scalar(@extra) and die 'BUG? extra files in index:', + (map { "\n\t".git_quote($_) } ($line, @extra)); + $line // die 'BUG? no ', git_quote($di->{path_b}), ' in', + (map { "\n\t".git_quote($_) } @ls); my ($info, $file) = split(/\t/, $line, 2); my ($mode_b, $oid_b_full, $stage) = split(/ /, $info); - $file eq $di->{path_b} or die -"BUG: index mismatch: file=$file != path_b=$di->{path_b}"; + $file eq $di->{path_b} or die "BUG? index mismatch: file=", + git_quote($file), ' != path_b=', git_quote($di->{path_b}); - dbg($self, "index at:\n$mode_b $oid_b_full\t$file"); + dbg($self, "index at:\n$mode_b $oid_b_full\t".git_quote($file)); my $tmp_git = $self->{tmp_git} or die 'no git working tree'; if ($self->{psgi_env}->{'pi-httpd.async'}) { async_check { git => $tmp_git }, $oid_b_full, -- 2.47.3