linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: perform commit ID check from external to git folder
@ 2020-06-11 12:59 Leon Romanovsky
  2020-06-11 18:22 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2020-06-11 12:59 UTC (permalink / raw)
  To: Andrew Morton, Andy Whitcroft, Joe Perches, Matteo Croce
  Cc: Leon Romanovsky, open list

From: Leon Romanovsky <leonro@mellanox.com>

The execution of scripts/checkpatch.pl in folder outside of git produces
complains about invalid commit ID, despite having valid one.

➜  /tmp /home/leonro/src/kernel/scripts/checkpatch.pl \
	--root=/home/leonro/src/kernel \
	--color=always \
	--summary-file /tmp/0001-RDMA-core-Annotate-CMA-unlock-helper-routine.patch

WARNING: Unknown commit id 'e83f195aa45c', maybe rebased or not pulled?
Fixes: e83f195aa45c ("RDMA/cm: Pull duplicated code into cm_queue_work_unlock()")

/tmp/0001-RDMA-core-Annotate-CMA-unlock-helper-routine.patch total: 0 errors, 1 warnings, 7 lines checked

Fixes: a8dd86bf7462 ("checkpatch.pl: warn on invalid commit id")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index eac40f0abd56..286bc78dc6fc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -966,7 +966,7 @@ sub seed_camelcase_includes {
 sub git_commit_info {
 	my ($commit, $id, $desc) = @_;

-	return ($id, $desc) if ((which("git") eq "") || !(-e ".git"));
+	return ($id, $desc) if ((which("git") eq "") || !(-e "$root/.git"));

 	my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
 	$output =~ s/^\s*//gm;
--
2.26.2


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

* Re: [PATCH] checkpatch.pl: perform commit ID check from external to git folder
  2020-06-11 12:59 [PATCH] checkpatch.pl: perform commit ID check from external to git folder Leon Romanovsky
@ 2020-06-11 18:22 ` Joe Perches
  2020-06-11 20:08   ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2020-06-11 18:22 UTC (permalink / raw)
  To: Leon Romanovsky, Andrew Morton, Andy Whitcroft, Matteo Croce
  Cc: Leon Romanovsky, open list

On Thu, 2020-06-11 at 15:59 +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The execution of scripts/checkpatch.pl in folder outside of git produces
> complains about invalid commit ID, despite having valid one.

There is already a slightly different test for this in -next
It also uses a environment test for GIT_DIR.

Try that one.  



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

* Re: [PATCH] checkpatch.pl: perform commit ID check from external to git folder
  2020-06-11 18:22 ` Joe Perches
@ 2020-06-11 20:08   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2020-06-11 20:08 UTC (permalink / raw)
  To: Joe Perches; +Cc: Andrew Morton, Andy Whitcroft, Matteo Croce, open list

On Thu, Jun 11, 2020 at 11:22:41AM -0700, Joe Perches wrote:
> On Thu, 2020-06-11 at 15:59 +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > The execution of scripts/checkpatch.pl in folder outside of git produces
> > complains about invalid commit ID, despite having valid one.
>
> There is already a slightly different test for this in -next
> It also uses a environment test for GIT_DIR.

If you are referring to this commit
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/scripts/checkpatch.pl?h=next-20200611&id=5bff933936a76a839e3c7f47f193cbf0d9904543

It didn't work for me, because I'm not setting GIT_DIR environment and
use "--root" switch from checkpatch.pl.

>
> Try that one.

It doesn't make too much sense to have two options to configure git
directory, one is GIT_DIR and another --root.

Thanks

>
>

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

end of thread, other threads:[~2020-06-11 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 12:59 [PATCH] checkpatch.pl: perform commit ID check from external to git folder Leon Romanovsky
2020-06-11 18:22 ` Joe Perches
2020-06-11 20:08   ` Leon Romanovsky

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).