]> Sergey Matveev's repositories - public-inbox.git/commitdiff
solver: handle copies properly
authorEric Wong <e@80x24.org>
Fri, 2 Sep 2022 10:11:47 +0000 (10:11 +0000)
committerEric Wong <e@80x24.org>
Fri, 2 Sep 2022 17:40:07 +0000 (17:40 +0000)
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...

lib/PublicInbox/SolverGit.pm

index 1e96d042e9d7ccd788354fc86fca034cb5e24195..610bd65b166c88489292a0c19224e034c2e4d5a6 100644 (file)
@@ -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);