checkpatch: report the right line # when using --emacs and --file
authorJoe Perches <joe@perches.com>
Wed, 9 Sep 2015 22:37:39 +0000 (15:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 10 Sep 2015 20:29:01 +0000 (13:29 -0700)
commit 34d8815f9512 ("checkpatch: add --showfile to allow input via pipe
to show filenames") broke the --emacs with --file option.

Fix it.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 780c91d82aa9a649b00df444515245bc22841fce..ea28336ea2a559749754b427471a1cef2bd18606 100755 (executable)
@@ -2166,7 +2166,11 @@ sub process {
                if ($showfile) {
                        $prefix = "$realfile:$realline: "
                } elsif ($emacs) {
-                       $prefix = "$filename:$linenr: ";
+                       if ($file) {
+                               $prefix = "$filename:$realline: ";
+                       } else {
+                               $prefix = "$filename:$linenr: ";
+                       }
                }
 
                if ($found_file) {