From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.4]) (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 904DE2F39B9 for ; Sun, 5 Apr 2026 19:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775416590; cv=none; b=q8/7Let6bh8+XqncN1blSC05fPJwwmX9cwTIrNOtQX6giiLmctNwdNtWfTm2EOFtn8heCcZmFY14LY6bqKshJHPo7tAuMEKBSdlGoeY2LAtF/61cox4ETArn302OKRgnTg9gZ6X83tPT1PuNpZPAVgFqRRQ8RulgDWqPkJWEbak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775416590; c=relaxed/simple; bh=iLW5FQ8sIBN65ZsHrhJUHq5xTCorO/m23KXZSkZaSqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YzTzgzRt0Yn/s9aCpoIF41QD2sBvKG2I1gzk8yShrEk++bRaz1l1prApCeYQHHWs7TJBeF+ogwhzW6aDm20ORdkH1JHFssAAER3BzxtUVukFHLi/UrwSWiOPNkp5OrgVXOqqwA8ntkLLk2h4ulEqSIeE2FnGQ4zepXfMloKKy4g= 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=kZv4sMOA; arc=none smtp.client-ip=117.135.210.4 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="kZv4sMOA" 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=ly kSDwOrAdvGRx/Id+XC0xOoinmY8mQNqi5eszqFO20=; b=kZv4sMOARNmSpQFU6t eVAUDWxb5Imvlq7J6D5+0+BcXKvGFn8C5eLflPj2wNtWW/t6krwlDAcLHKPQekyO p/FmF10wbnOjtKcpw5BA0GW96sRLnIXyq387LWEIKgq2zwPYbmjFjOjUq0rxNqxd awh9CP1UDvjt08bZShXHAwE38= Received: from localhost.localdomain (unknown []) by gzsmtp3 (Coremail) with SMTP id PigvCgA3WorytNJpOg2CCA--.145S3; Mon, 06 Apr 2026 03:16:07 +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 v2 1/2] scripts: allow checkpatch and get_maintainer in sparse checkouts Date: Mon, 6 Apr 2026 03:15:54 +0800 Message-Id: <20260405191555.80315-2-create0818@163.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20260405191555.80315-1-create0818@163.com> References: <20260405185504.76040-1-create0818@163.com> <20260405191555.80315-1-create0818@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:PigvCgA3WorytNJpOg2CCA--.145S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxJr4UXFy5Zry3urW3KrW3KFg_yoW8tw43pF 47J3W3Jr4xCr4UJw1IgF1Fqr13Ga13t3W3KFn8Wr15KFn8Kws7XrWayFn8Ja4kZFZI9FW2 qwsYq3s3Gw17WFUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zN4EiUUUUUU= X-CM-SenderInfo: pfuht3jhqyimi6rwjhhfrp/xtbCwBd5smnStPfpIQAA3s checkpatch.pl and get_maintainer.pl currently reject sparse checkouts because top_of_kernel_tree() insists on top-level directories such as arch/, drivers/ 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 present. Relax the tree check to require only the top-level files and directories these scripts actually need so they continue to recognize full trees while also 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 e56374662..259abff97 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1397,10 +1397,10 @@ exit($exit); sub top_of_kernel_tree { my ($root) = @_; + # Allow sparse checkouts that still contain the files these scripts need. my @tree_check = ( "COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile", - "README", "Documentation", "arch", "include", "drivers", - "fs", "init", "ipc", "kernel", "lib", "scripts", + "README", "Documentation", "scripts", ); foreach my $check (@tree_check) { diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 4414194be..1d032f0e4 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 .= "/"; } + # Allow sparse checkouts that still contain the files these scripts need. 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; } -- 2.39.5 (Apple Git-154)