diff mbox

[1/5] check_GNU_style.sh: Don't use filename prefix for one patch

Message ID 5551AB5D.3070409@mentor.com
State New
Headers show

Commit Message

Tom de Vries May 12, 2015, 7:27 a.m. UTC
Hi,

this patch makes sure that we don't print the patch filename in front of the 
error messages, if we're checking just one file. Making the lines shorter makes 
things easier to read. And since we're only processing one file, there's no 
information lost.

OK for trunk?

Thanks,
- Tom

Comments

Jeff Law May 12, 2015, 2:59 p.m. UTC | #1
On 05/12/2015 01:27 AM, Tom de Vries wrote:
> Hi,
>
> this patch makes sure that we don't print the patch filename in front of
> the error messages, if we're checking just one file. Making the lines
> shorter makes things easier to read. And since we're only processing one
> file, there's no information lost.
>
> OK for trunk?
>
> Thanks,
> - Tom
>
>
> 0001-check_GNU_style.sh-Don-t-use-filename-prefix-for-one.patch
>
>
> [PATCH 1/5] check_GNU_style.sh: Don't use filename prefix for one
>   patch
>
> 2015-05-11  Tom de Vries<tom@codesourcery.com>
>
> 	* check_GNU_style.sh: Don't use a filename prefix if we're only
> 	processing one patch file.
OK.
jeff
diff mbox

Patch

[PATCH 1/5] check_GNU_style.sh: Don't use filename prefix for one
 patch

2015-05-11  Tom de Vries  <tom@codesourcery.com>

	* check_GNU_style.sh: Don't use a filename prefix if we're only
	processing one patch file.
---
 contrib/check_GNU_style.sh | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh
index e8d5dca..eeff48f 100755
--- a/contrib/check_GNU_style.sh
+++ b/contrib/check_GNU_style.sh
@@ -36,6 +36,8 @@  EOF
 }
 
 test $# -eq 0 && usage
+nfiles=$#
+files="$*"
 
 inp=check_GNU_style.inp
 tmp=check_GNU_style.tmp
@@ -44,9 +46,15 @@  tmp=check_GNU_style.tmp
 trap "rm -f $inp $tmp" 0
 trap "rm -f $inp $tmp ; exit 1" 1 2 3 5 9 13 15
 
-grep -nH '^+' $* \
-	| grep -v ':+++' \
-	> $inp
+if [ $nfiles -eq 1 ]; then
+    # There's no need for the file prefix if we're dealing only with one file.
+    format="-n"
+else
+    format="-nH"
+fi
+grep $format '^+' $files \
+    | grep -v ':+++' \
+    > $inp
 
 # Grep
 g (){
-- 
1.9.1