From nobody Sun Jun 14 20:01:46 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A38DF2882DE for ; Sun, 5 Apr 2026 18:55:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775415333; cv=none; b=vCXhTkyDt9oRhe+NZSKDHNvqYsVpTpc3SaCE+uoYPKIGY79T7u8w793TXlbvVz+V4lHt+DjP8H8wwkaTQa0zUl1NaTcEb4gHqIiMZmKHjY1uGjHNov/PsuMRLvBBgwRcSsStWdYi4p/PH4FdlfZa/7r3MBVk+Y155e0uTH/K4Vo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775415333; c=relaxed/simple; bh=B/B4d5A7coRfD4dFr8GkcdHXZje3OlM1y3/3tjbpiKM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=j5yjyAFNoqba4lpMIlsDFv+vuk5UwAhSi/1PggQ2wMZzbOK6aT4JnXiNL1eYgc4D3SAZADCLXmWsB2a0HyxcoieKbSL7D+Wba0i6sMy/7HMu5F7MBl+Kn4+Py7S5MnbDKZmqPkLfc7/QHQ4IbHBnM4gX0JuTOdt8ttL9s7R/7kk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=TIRertee; arc=none smtp.client-ip=117.135.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="TIRertee" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=lM 5nz4rGy6jKkLAt6Hxh7avQAgtVKncyKzaXmqIK3cA=; b=TIRerteeQ5goZTEqRl IioRuGYsD6hAKVpP8ebO+4anIUIQuj9ZaF50CuRxeOMbmwKjgkPLORyL99CQAfXI UjrcvoPt/d1qviMgT/tfs7ju/Zwb6YXOcPKMu0hCpcYFB3OULEnQlrQaKRD/KZ47 qkXYHbgUMILWSvD76374kOv4w= Received: from localhost.localdomain (unknown []) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wBXXTQNsNJp9R_ADQ--.58951S2; Mon, 06 Apr 2026 02:55:12 +0800 (CST) From: CaoRuichuang To: apw@canonical.com, joe@perches.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org, CaoRuichuang Subject: [PATCH] scripts: allow checkpatch and get_maintainer in sparse checkouts Date: Mon, 6 Apr 2026 02:55:04 +0800 Message-Id: <20260405185504.76040-1-create0818@163.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wBXXTQNsNJp9R_ADQ--.58951S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJr4UXFy5Zry3urW3KrW3KFg_yoW8tw1DpF 43J3W3Jr4xCr4UJw4IgF1Fqr13Wa13t3W3KFn8Wr15KFn8Kws2qrWSyFn8Ja4kuFZagFW7 tanaq3s3Gw1xWFUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pi8uctUUUUU= X-CM-SenderInfo: pfuht3jhqyimi6rwjhhfrp/xtbCvxE-eGnSsBGYBwAA3s Content-Type: text/plain; charset="utf-8" checkpatch.pl and get_maintainer.pl currently reject sparse checkouts becau= se top_of_kernel_tree() insists on top-level directories such as arch/, dri= vers/ and fs/ being present in the working tree. That unnecessarily blocks common patch preparation workflows using partial = clones or sparse checkouts, even when the files needed by these tools are p= resent. Relax the tree check to require only the top-level files and directories th= ese scripts actually need so they continue to recognize full trees while al= so working from sparse checkouts. Signed-off-by: CaoRuichuang --- scripts/checkpatch.pl | 4 ++-- scripts/get_maintainer.pl | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e563746..259abff 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1397,10 +1397,10 @@ exit($exit); sub top_of_kernel_tree { my ($root) =3D @_; =20 + # Allow sparse checkouts that still contain the files these scripts need. my @tree_check =3D ( "COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile", - "README", "Documentation", "arch", "include", "drivers", - "fs", "init", "ipc", "kernel", "lib", "scripts", + "README", "Documentation", "scripts", ); =20 foreach my $check (@tree_check) { diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 4414194..1d032f0 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -1157,6 +1157,7 @@ sub top_of_kernel_tree { if ($lk_path ne "" && substr($lk_path,length($lk_path)-1,1) ne "/") { $lk_path .=3D "/"; } + # Allow sparse checkouts that still contain the files these scripts ne= ed. if ( (-f "${lk_path}COPYING") && (-f "${lk_path}CREDITS") && (-f "${lk_path}Kbuild") @@ -1164,14 +1165,6 @@ sub top_of_kernel_tree { && (-f "${lk_path}Makefile") && (-f "${lk_path}README") && (-d "${lk_path}Documentation") - && (-d "${lk_path}arch") - && (-d "${lk_path}include") - && (-d "${lk_path}drivers") - && (-d "${lk_path}fs") - && (-d "${lk_path}init") - && (-d "${lk_path}ipc") - && (-d "${lk_path}kernel") - && (-d "${lk_path}lib") && (-d "${lk_path}scripts")) { return 1; } --=20 2.39.5 (Apple Git-154)