Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1970555ybz; Sat, 2 May 2020 11:57:59 -0700 (PDT) X-Google-Smtp-Source: APiQypJFEnRtsesn/S7B0rNkARi+zURxdy183pa+CzE8TFsvcahH/5cKdpMG37YnTFVowRZpemCW X-Received: by 2002:aa7:dd84:: with SMTP id g4mr8770214edv.257.1588445879602; Sat, 02 May 2020 11:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588445879; cv=none; d=google.com; s=arc-20160816; b=RgAUyY986nYYz1fB594gMbRu1SawUAc4Oq0/21roNRNzJu3ocsDvxLdNSpE8uo48Pb IgxCRrO00WnjOZqOcIPEvq1BvF8CZHtOwbl6tschBu3Kwgc8bGxIz5BIr+wBGQtjDxUm 4e5L/BY5RAgWByjfHNU5pIc8C+indIeOeHnRFp2p/yBG1p4AjIAclUYo5sb75zMU9qAz 8m4IzwyC5opX3oJQJelwYeNmpu6Z2GfwQUwgMkwWgBL52T9AX5FQfc/eQtogA5zj1Czs 3AeWu7boW7R9cVrM1SIjthJxHm5VFMxq6IVSSGSZQAeaLJQe2jZnSAfKJjl2CwYI+IYJ gJbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=2r+1yVPOglt4gj5XLUdHS7cxi4oqb67JRmvdg4JUpMs=; b=cE9Dv/TuIjsg3TlLOLHoC1cmcEm74NpzZqAYqOu7QDFe7Tb252MUyDXkBRfvYY4vQJ 9pW9+noDLFqTWq8eSXKhpkSYLicOkEOD9v4Uq/+ZpLqZtMiaXZhwX0CeccoHUkcx+Yzx l9KjOBtEIQbFRNa9BRvHcf+KPsxCfEKvVa03KPxBMC8MhR4WYHlLr2MV0R3+vHQOgucN 0eAXkKXsNKQ4XdCr/BLyjcGLUYKxaL8lu4G0sO0jZEy6Ku7CPoaYFmIWpyHM6Zk2lP3Z 99FKVnzpYnR4bP/wu4Cwa1Pd5ZMildpldwsUOZ2vJ4xiI0n1IqeS6XfSl5EmHedSEiGe yRPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iE9qi38I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si3860684ejw.31.2020.05.02.11.57.36; Sat, 02 May 2020 11:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iE9qi38I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728465AbgEBSyL (ORCPT + 99 others); Sat, 2 May 2020 14:54:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728343AbgEBSyL (ORCPT ); Sat, 2 May 2020 14:54:11 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB650C061A0C; Sat, 2 May 2020 11:54:09 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id h12so5445767pjz.1; Sat, 02 May 2020 11:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=2r+1yVPOglt4gj5XLUdHS7cxi4oqb67JRmvdg4JUpMs=; b=iE9qi38Iu6GH1F7xZ9HHUiU/kJXeyzOqk+2gyFZg2F+GkePgCBKPIcmnYfhYqrgWiv 9dcrrkrP+kneqozsqiEu7UDNFm1Vcr4qCSG5tdQK11QMGeGHB7A/GQ87qkWeolCePbyd pg6LMDmOO3KUXdzmDhTB80BNetDwX5TEatu8gczuCKWLLuPv16e0wPGRhsQ+ws2OaQGl kQiR6ToxoSL0tEZCgFfY0sLhjW+mu6ZWSjNQ4ExFuPspYvcwPLQAgeU33EWwKJ9Aedj6 SMpOt9yQVEYKGYaXstv8oYjZZTEq6hgBCcFq9uWUX0d27IqXKrrLj52l4BY6itw3iptV WycQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:mime-version:content-disposition:user-agent; bh=2r+1yVPOglt4gj5XLUdHS7cxi4oqb67JRmvdg4JUpMs=; b=UKJaQh5cQ350MHkbMlXxYjtG9fUBBCJIXxjZySrCQR9kqVMlDx1Awy9JA33kuz7Swi IUE/mp/HsmkG9V66Qlar2FC1H+PU+UIDDLaPCG43XDQuPTxFCWdTGCEgYAmpdN2VP8J/ 77sN+tb2hCyGT27dAuBdoVlg4GlFbEsDytgd06YmXe//bBRQG+w/7PUmPHdNAEWb++Ww 3uBZCUgET0Ezmq5VvwE76WaHVCHzLy3kUr9ZCCEDaLwbjZPZN6VfGEzbBDXWjYxImw68 UUcovb/TOB/LV3Alb4MXHN9ElgXqhHabzaaIRtlTfkapaqvztG5xse3Dvy9Hc3W+w8W6 q4xA== X-Gm-Message-State: AGi0PubSOtFFXFyWEmPf3pgIiqiMEKkQS3ZGFViUclBnlaFVOss0z2Kk kMgTiT3qOVUpRicsyxzNrPLUTrcd X-Received: by 2002:a17:90a:1464:: with SMTP id j91mr7121807pja.87.1588445649250; Sat, 02 May 2020 11:54:09 -0700 (PDT) Received: from udknight.localhost ([59.57.158.27]) by smtp.gmail.com with ESMTPSA id bo19sm2694712pjb.26.2020.05.02.11.54.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 May 2020 11:54:08 -0700 (PDT) Received: from udknight.localhost (localhost [127.0.0.1]) by udknight.localhost (8.14.9/8.14.4) with ESMTP id 042IontN009203; Sun, 3 May 2020 02:50:49 +0800 Received: (from root@localhost) by udknight.localhost (8.14.9/8.14.9/Submit) id 042IofgZ009202; Sun, 3 May 2020 02:50:41 +0800 Date: Sun, 3 May 2020 02:50:41 +0800 From: Wang YanQing To: joe@perches.com Cc: Andy Whitcroft , linux-kernel@vger.kernel.org, Alexei Starovoitov , Matteo Croce , Markus.Elfring@web.de, kernel-janitors@vger.kernel.org Subject: [PATCH] checkpatch: fix can't check for too long invalid commit id Message-ID: <20200502185041.GA9082@udknight> Mail-Followup-To: Wang YanQing , joe@perches.com, Andy Whitcroft , linux-kernel@vger.kernel.org, Alexei Starovoitov , Matteo Croce , Markus.Elfring@web.de, kernel-janitors@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current UNKNOWN_COMMIT_ID doesn't check for 41+ length commit id, and although GIT_COMMIT_ID will check for 41+ length commit id, but it willn't warn anything about it due to 41+ length commit will never be defined. This patch moves the unknown commit id check for normal commit description to GIT_COMMIT_ID, and uses ERROR instead of WARN, because unknown commit id is total useless to track change history in changelog, it deserves the ERROR. Signed-off-by: Wang YanQing --- After this patch, in another patch 'checkpatch: add support to check 'Fixes:' tag format', I will delete UNKNOWN_COMMIT_ID, because we don't need it anymore after GIT_COMMIT_ID could do the same check as UNKNOWN_COMMIT_ID for 'Fixes:' tag. scripts/checkpatch.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 23a001a..143bb43 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2865,8 +2865,18 @@ sub process { ($id, $description) = git_commit_info($orig_commit, $id, $orig_desc); + if (!defined($id)) { + if ($long) { + ERROR("GIT_COMMIT_ID", + "Unknown commit id '$orig_commit' is too long, maybe misspelled?\n" . $herecurr); + } else { + ERROR("GIT_COMMIT_ID", + "Unknown commit id '$orig_commit', maybe rebased or not pulled?\n" . $herecurr); + } + } + if (defined($id) && - ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) { + ($short || $space || $case || ($orig_desc ne $description) || !$hasparens)) { ERROR("GIT_COMMIT_ID", "Please use git commit description style 'commit <12+ chars of sha1> (\"\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr); } @@ -2969,7 +2979,7 @@ sub process { } # check for invalid commit id - if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) { + if ($in_commit_log && $line =~ /(^fixes:)\s+([0-9a-f]{6,40})\b/i) { my $id; my $description; ($id, $description) = git_commit_info($2, undef, undef); -- 1.8.5.6.2.g3d8a54e.dirty