From nobody Thu Apr 25 04:40:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1523008345543187.96081237806573; Fri, 6 Apr 2018 02:52:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94CCBC058EBC; Fri, 6 Apr 2018 09:52:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A3355E1C5; Fri, 6 Apr 2018 09:52:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 801E74CA9C; Fri, 6 Apr 2018 09:52:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w369pcrt009060 for ; Fri, 6 Apr 2018 05:51:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 03CF82023235; Fri, 6 Apr 2018 09:51:38 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-39.ams2.redhat.com [10.36.117.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 537D82023227 for ; Fri, 6 Apr 2018 09:51:37 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Fri, 6 Apr 2018 11:51:35 +0200 Message-Id: <20180406095136.15083-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] series-diff: tweak same-patch optimization X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 06 Apr 2018 09:52:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When diffing a single patch (i.e. a series without a cover letter) against = a multi-patch series (with the cover latter), the patch was hard-coded to diff against th= e new series's cover letter. Only apply the cover letter special case when both = sides are multi-patch/. --- www/templates/series-diff.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/www/templates/series-diff.html b/www/templates/series-diff.html index 193665e..7469308 100644 --- a/www/templates/series-diff.html +++ b/www/templates/series-diff.html @@ -136,10 +136,14 @@ function crossDiff(left, right) { =20 // As an optimization, look for equal patches // Also, the cover letters always go against each other - quick_left[0] =3D quick_right[0] =3D 0 - for (i =3D 1; i < orig_left_length; i++) { - for (j =3D 1; j < orig_right_length; j++) { - if (left[i].text() =3D=3D right[j].text()) { + have_cover_letter =3D orig_left_length > 1 && orig_right_length > 1 + for (i =3D 0; i < orig_left_length; i++) { + if (i =3D=3D 0 && have_cover_letter) { + quick_left[0] =3D quick_right[0] =3D 0 + continue; + } + for (j =3D 0; j < orig_right_length; j++) { + if (quick_right[j] =3D=3D -1 && left[i].text() =3D=3D right[j]= .text()) { console.log(i + "," + j + " --> exact match"); quick_left[i] =3D j quick_right[j] =3D i @@ -206,7 +210,7 @@ function crossDiff(left, right) { i =3D matching[j][0]; var ops =3D matching[j][2]; // Never hide the cover letter - var hide =3D i > 0 && quick_left[i] !=3D -1; + var hide =3D quick_left[i] !=3D -1 && !(i =3D=3D 0 && have_cover_l= etter); diffUsingJS(left[i], right[j], ops, hide); deleteFromArray(remaining_lhs_patches, i); =20 --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel