From nobody Fri Nov 7 00:48:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544628633199493.38328103768424; Wed, 12 Dec 2018 07:30:33 -0800 (PST) Received: from localhost ([::1]:45595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6T1-0006Li-Vz for importer@patchew.org; Wed, 12 Dec 2018 10:30:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MR-0000hG-3q for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MO-00007S-Hh for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:42 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MK-0008L9-PW for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: by mail-wr1-x443.google.com with SMTP id q18so18081112wrx.9 for ; Wed, 12 Dec 2018 07:23:24 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=PDjUEFHL/ho8c/m4r+hfYPSP5W70O1tCjmOSIOtYvbY=; b=jTqy6EBXjaE9GU0qy4WYLQOsSfGf1G0+mKFpcSPimoBb7s0D7Rvq0dPiqpAjS7EL82 Ib4Ga3f/D7Le7Yhz6Vqz/djlK3ggOv4hiFOul20iTzPvn+H6zvecJ5N4LOxPJNBKT0Sd DcgHItdcwMtHp7qHjK1tk65Iw9UaHvWZvsD2Ka1LouYIIVDmlNSTwK3ZfbnG4QW4jtmO Y9ABucKnIeaShptCRykbaGD9s0FPbSizQ7lsR1dHwXTv0yijVq7UnB0l5Tfyjv/I2Gbe aA9qaJesmSn8VNbbtMbefMbuxHazkdEo/9Lbxp1Uc3OuF4PF8Hb/F2vDnM3Cch1yOzWm njXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=PDjUEFHL/ho8c/m4r+hfYPSP5W70O1tCjmOSIOtYvbY=; b=HW3ylhE6v8MJ6xzaSPIzPH6GklH680NTti0pTDywTVzmS3E2SCdPWpavEhbCp4HofO 9hZ6kf5cOeXqpudMnx+73RHkQwz4xj8wsyaIibVru9SB8EIPF1+FGwAu+vmw/LN7k7u7 Zo5Zk+GzhHHwEJYHbFPxniXn8ugW+x0cAbsZqiY/osKVTMILszOkSk2FJNpheMIIrV3T dOr8i4/eA9nXh++Gg2MpMN1mQOizgZLJwYb9olshccJJUPUcZgE25r/n2bWKe9g+3iyB HwJB616rOOBsMgGjqR3C+A7VnGx7N3VAwBPzhuhTOlSFyl2hwFAmOf4F6d1hwJYRuIaQ qh+Q== X-Gm-Message-State: AA+aEWZztsCLmkDIbXEvqVzQut+1dW2HKJMQyGH3vDT+L7OUBygQNTp+ PM5OK2NylKEwxc0Izi8tU5kcc094 X-Google-Smtp-Source: AFSGD/V8sOMe4xgQaoXWSidlXpTM55+U5j4u6bmmqsHDztqn9io0JaDR9IyMCX9W+ZS3wFO+yE61ww== X-Received: by 2002:adf:e08c:: with SMTP id c12mr16684539wri.199.1544628203525; Wed, 12 Dec 2018 07:23:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:26 +0100 Message-Id: <1544628195-37728-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patches or files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Similar to how patchew output looks like for multiple patches, say what file or patch is being tested _before_ emitting errors. This is clearer to a human that scans the output from top to bottom. In addition, provide a truncated commit hash and subject instead of the full hash, and process the commits first-to-last rather than last-to-first. Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c ("checkpatch: reduce number of `git log` calls with --git", 2016-03-20). Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 506aa6c..2edb4e2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -340,13 +340,18 @@ my @lines =3D (); my $vname; if ($chk_branch) { my @patches; + my %git_commits =3D (); my $HASH; - open($HASH, "-|", "git", "log", "--format=3D%H", $ARGV[0]) || - die "$P: git log --format=3D%H $ARGV[0] failed - $!\n"; - - while (<$HASH>) { - chomp; - push @patches, $_; + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=3D%= H %s", $ARGV[0]) || + die "$P: git log --reverse --no-merges --format=3D'%H %s' $ARGV[0] faile= d - $!\n"; + + for my $line (<$HASH>) { + $line =3D~ /^([0-9a-fA-F]{40,40}) (.*)$/; + next if (!defined($1) || !defined($2)); + my $sha1 =3D $1; + my $subject =3D $2; + push(@patches, $sha1); + $git_commits{$sha1} =3D $subject; } =20 close $HASH; @@ -354,21 +359,31 @@ if ($chk_branch) { die "$P: no revisions returned for revlist '$chk_branch'\n" unless @patches; =20 + my $i =3D 1; + my $num_patches =3D @patches; for my $hash (@patches) { my $FILE; open($FILE, '-|', "git", "show", $hash) || die "$P: git show $hash - $!\n"; - $vname =3D $hash; while (<$FILE>) { chomp; push(@rawlines, $_); } close($FILE); + $vname =3D substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; + if ($num_patches > 1 && $quiet =3D=3D 0) { + print "$i/$num_patches Checking commit $vname\n"; + $vname =3D "Patch $i/$num_patches"; + } else { + $vname =3D "Commit " . $vname; + } if (!process($hash)) { $exit =3D 1; + print "\n" if ($num_patches > 1 && $quiet =3D=3D 0); } @rawlines =3D (); @lines =3D (); + $i++; } } else { for my $filename (@ARGV) { @@ -387,6 +402,7 @@ if ($chk_branch) { } else { $vname =3D $filename; } + print "Checking $filename...\n" if @ARGV > 1 && $quiet =3D=3D 0; while (<$FILE>) { chomp; push(@rawlines, $_); --=20 1.8.3.1