outside repository fatal error
The commit bcf4271d4bc3 ("checkpatch: allow not using -f with files that are in git") in linux-next seems to cause checkpatch to fail on a file containing a patch if that file is not in the directory containing the Linux kernel. Is that intentional?
thanks,
julia
Joe Perches
maintainerQuoted 4 lines · Julia Lawall
The commit
bcf4271d4bc3("checkpatch: allow not using -f with files that are in git") in linux-next seems to cause checkpatch to fail on a file containing a patch if that file is not in the directory containing the Linux kernel.
Thanks for the report.
Quoted 1 line
Is that intentional?
No. It doesn't really fail, it just emits a fatal warning from git.
I believe this makes it better by silencing the error.
---
scripts/checkpatch.pl +1 -1
@@ -981,7 +981,7 @@ sub git_is_single_file { return 0 if ((which("git") eq "") || !(-e "$gitroot")); - my $output = `${git_command} ls-files -- $filename`; + my $output = `${git_command} ls-files -- $filename 2>/dev/null`; my $count = $output =~ tr/\n//; return $count eq 1 && $output =~ m{^${filename}$}; }
Julia Lawall
Reviewed-byQuoted 6 lines · Joe Perches
Quoted 4 lines · Julia Lawall
The commit
bcf4271d4bc3("checkpatch: allow not using -f with files that are in git") in linux-next seems to cause checkpatch to fail on a file containing a patch if that file is not in the directory containing the Linux kernel.
Quoted 8 lines
Thanks for the report.
Quoted 1 line
Is that intentional?
No. It doesn't really fail, it just emits a fatal warning from git.
I believe this makes it better by silencing the error.
It seems fine now.
julia
Quoted 18 lines
---
scripts/checkpatch.pl +1
-1@@ -981,7 +981,7 @@ sub git_is_single_file { return 0 if ((which("git") eq "") || !(-e "$gitroot")); - my $output = `${git_command} ls-files -- $filename`; + my $output = `${git_command} ls-files -- $filename 2>/dev/null`; my $count = $output =~ tr/\n//; return $count eq 1 && $output =~ m{^${filename}$}; }
Joe Perches
maintainerPATCH 1/1 checkpatch: Fix git "fatal" warning if file argument outside kernel tree
In reply to Joe Perchescommit bcf4271d4bc3 ("checkpatch: allow not using -f with files that are in git") in linux-next causes checkpatch to emit a fatal message:
fatal: <file>: '<file>' is outside repository at '<kernel_dir>'
Fix that by sending git's error output to /dev/null instead.
---
scripts/checkpatch.pl +1 -1
@@ -981,7 +981,7 @@ sub git_is_single_file { return 0 if ((which("git") eq "") || !(-e "$gitroot")); - my $output = `${git_command} ls-files -- $filename`; + my $output = `${git_command} ls-files -- $filename 2>/dev/null`; my $count = $output =~ tr/\n//; return $count eq 1 && $output =~ m{^${filename}$}; }