unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH 0/2] solver: fix rename handling
@ 2022-09-02 10:11 Eric Wong
  2022-09-02 10:11 ` [PATCH 1/2] solver: handle copies properly Eric Wong
  2022-09-02 10:11 ` [PATCH 2/2] solver: do not count duplicates in patch count Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2022-09-02 10:11 UTC (permalink / raw)
  To: meta

It takes about 5s to generate uncached, but applying 66 patches
with a copy in the middle works properly, now:
https://yhbt.net/lore/all/34d644a519c/s/?b=target/arm/helper-mve.h

Eric Wong (2):
  solver: handle copies properly
  solver: do not count duplicates in patch count

 lib/PublicInbox/SolverGit.pm | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] solver: handle copies properly
  2022-09-02 10:11 [PATCH 0/2] solver: fix rename handling Eric Wong
@ 2022-09-02 10:11 ` Eric Wong
  2022-09-02 10:11 ` [PATCH 2/2] solver: do not count duplicates in patch count Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2022-09-02 10:11 UTC (permalink / raw)
  To: meta

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 | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] solver: do not count duplicates in patch count
  2022-09-02 10:11 [PATCH 0/2] solver: fix rename handling Eric Wong
  2022-09-02 10:11 ` [PATCH 1/2] solver: handle copies properly Eric Wong
@ 2022-09-02 10:11 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2022-09-02 10:11 UTC (permalink / raw)
  To: meta

We're considering duplicate patches from cross-posted lists
identical, so don't double-count them when displaying the
"applying [X/Y]" message since (successful) duplicates get
skipped.
---
 lib/PublicInbox/SolverGit.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm
index 610bd65b..ac655f34 100644
--- a/lib/PublicInbox/SolverGit.pm
+++ b/lib/PublicInbox/SolverGit.pm
@@ -486,15 +486,14 @@ sub do_git_apply ($) {
 	my @cmd = (qw(git apply --cached --ignore-whitespace
 			--unidiff-zero --whitespace=warn --verbose));
 	my $len = length(join(' ', @cmd));
-	my $total = $self->{tot};
 	my $di; # keep track of the last one for "git ls-files"
 	my $prv_oid_b;
 
 	do {
 		my $i = ++$self->{nr};
 		$di = shift @$patches;
-		dbg($self, "\napplying [$i/$total] " . di_url($self, $di) .
-			"\n" . $di->{hdr_lines});
+		dbg($self, "\napplying [$i/$self->{nr_p}] " .
+			di_url($self, $di) . "\n" . $di->{hdr_lines});
 		my $path = $di->{n};
 		$len += length($path) + 1;
 		push @cmd, $path;
@@ -557,6 +556,7 @@ sub extract_diffs_done {
 		unshift @{$self->{patches}}, @$diffs;
 		dbg($self, "found $want->{oid_b} in " .  join(" ||\n\t",
 			map { di_url($self, $_) } @$diffs));
+		++$self->{nr_p};
 
 		# good, we can find a path to the oid we $want, now
 		# lets see if we need to apply more patches:
@@ -679,7 +679,7 @@ sub solve ($$$$$) {
 	$self->{oid_want} = $oid_want;
 	$self->{out} = $out;
 	$self->{seen_oid} = {};
-	$self->{tot} = 0;
+	$self->{tot} = $self->{nr_p} = 0;
 	$self->{psgi_env} = $env;
 	$self->{have_hints} = 1 if scalar keys %$hints;
 	$self->{todo} = [ { %$hints, oid_b => $oid_want } ];

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-02 10:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-02 10:11 [PATCH 0/2] solver: fix rename handling Eric Wong
2022-09-02 10:11 ` [PATCH 1/2] solver: handle copies properly Eric Wong
2022-09-02 10:11 ` [PATCH 2/2] solver: do not count duplicates in patch count Eric Wong

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).