linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: use correct gitroot when running from non-top-level dir
@ 2021-09-13 23:33 Peter Collingbourne
  2022-02-23 22:32 ` Peter Collingbourne
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Collingbourne @ 2021-09-13 23:33 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: Peter Collingbourne, linux-kernel

My workflow usually requires running checkpatch.pl from a subdirectory
of the kernel source tree. This works for the most part, but the script
will be unable to find the .git directory and will therefore refuse to
run any git commands (so, e.g. commit ID verification will fail). Fix
it by prepending $root to $gitroot when a root is set.

This also requires fixing one root directory assumption in a git
invocation.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Link: https://linux-review.googlesource.com/id/I33dc5f38e2bfcd95c8ea59933bba5305cce50404
---
 scripts/checkpatch.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c27d2312cfc3..171c5993efb4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -434,6 +434,8 @@ if ($tree) {
 		print "Must be run from the top-level dir. of a kernel tree\n";
 		exit(2);
 	}
+
+	$gitroot = "$root/$gitroot";
 }
 
 my $emitted_corrupt = 0;
@@ -1131,7 +1133,7 @@ sub seed_camelcase_includes {
 	}
 
 	if (-e "$gitroot") {
-		$files = `${git_command} ls-files "include/*.h"`;
+		$files = `${git_command} ls-files "$root/include/*.h"`;
 		@include_files = split('\n', $files);
 	}
 
-- 
2.33.0.309.g3052b89438-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch.pl: use correct gitroot when running from non-top-level dir
  2021-09-13 23:33 [PATCH] checkpatch.pl: use correct gitroot when running from non-top-level dir Peter Collingbourne
@ 2022-02-23 22:32 ` Peter Collingbourne
  2022-11-04 16:51   ` Peter Collingbourne
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Collingbourne @ 2022-02-23 22:32 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: Linux Kernel Mailing List

On Mon, Sep 13, 2021 at 4:33 PM Peter Collingbourne <pcc@google.com> wrote:
>
> My workflow usually requires running checkpatch.pl from a subdirectory
> of the kernel source tree. This works for the most part, but the script
> will be unable to find the .git directory and will therefore refuse to
> run any git commands (so, e.g. commit ID verification will fail). Fix
> it by prepending $root to $gitroot when a root is set.
>
> This also requires fixing one root directory assumption in a git
> invocation.

Ping.

Peter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch.pl: use correct gitroot when running from non-top-level dir
  2022-02-23 22:32 ` Peter Collingbourne
@ 2022-11-04 16:51   ` Peter Collingbourne
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Collingbourne @ 2022-11-04 16:51 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn
  Cc: Linux Kernel Mailing List

On Wed, Feb 23, 2022 at 2:32 PM Peter Collingbourne <pcc@google.com> wrote:
>
> On Mon, Sep 13, 2021 at 4:33 PM Peter Collingbourne <pcc@google.com> wrote:
> >
> > My workflow usually requires running checkpatch.pl from a subdirectory
> > of the kernel source tree. This works for the most part, but the script
> > will be unable to find the .git directory and will therefore refuse to
> > run any git commands (so, e.g. commit ID verification will fail). Fix
> > it by prepending $root to $gitroot when a root is set.
> >
> > This also requires fixing one root directory assumption in a git
> > invocation.
>
> Ping.

Ping^2.

Peter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-04 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 23:33 [PATCH] checkpatch.pl: use correct gitroot when running from non-top-level dir Peter Collingbourne
2022-02-23 22:32 ` Peter Collingbourne
2022-11-04 16:51   ` Peter Collingbourne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).