From: Eric Wong Date: Fri, 2 Sep 2022 10:11:47 +0000 (+0000) Subject: solver: handle copies properly X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=0d2dd565d44c068d641d25d6b4e8e2885af05a2d;p=public-inbox.git solver: handle copies properly At least enough to get 66 patches applied to handle /lore/all/34d644a519c/s/?b=target/arm/helper-mve.h properly. I noticed this bug due to a: E: BUG: extra files in index: <100644 e91f526a1a83edb2b56798388a355b1c3729b4bd 0#011target/arm/translate-mve.c> line in my syslog However, the $TOTAL in "applying [X/$TOTAL]" in the debug log is seems off... --- diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 1e96d042..610bd65b 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -407,18 +407,17 @@ sub mark_found ($$$) { sub parse_ls_files ($$) { my ($self, $bref) = @_; my ($qsp_err, $di) = delete @$self{qw(-qsp_err -cur_di)}; - die "git ls-files error:$qsp_err" if $qsp_err; + die "git ls-files -s -z error:$qsp_err" if $qsp_err; - my ($line, @extra) = split(/\0/, $$bref); + 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('> <', @extra), ">"; - + join('> <', $line, @extra), ">"; + $line // die "no \Q$di->{path_b}\E in <",join('> <', @ls), '>'; my ($info, $file) = split(/\t/, $line, 2); my ($mode_b, $oid_b_full, $stage) = split(/ /, $info); - if ($file ne $di->{path_b}) { - die + $file eq $di->{path_b} or die "BUG: index mismatch: file=$file != path_b=$di->{path_b}"; - } my $tmp_git = $self->{tmp_git} or die 'no git working tree'; my (undef, undef, $size) = $tmp_git->check($oid_b_full);