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 2/2] solver: do not count duplicates in patch count
Date: Fri,  2 Sep 2022 10:11:48 +0000	[thread overview]
Message-ID: <20220902101148.20708-3-e@80x24.org> (raw)
In-Reply-To: <20220902101148.20708-1-e@80x24.org>

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 } ];

      parent reply	other threads:[~2022-09-02 10:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=20220902101148.20708-3-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).