]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coccinelle: run spatch just on version-controlled files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 20 Apr 2018 13:07:42 +0000 (15:07 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 Jun 2018 09:48:50 +0000 (11:48 +0200)
Also, allow run-cocinnelle.sh to be started from any directory.

Unfortunately set -x does not work nicely anymore, because the list is
too verbose. Replace it by an echo line.

coccinelle/run-coccinelle.sh

index f463f5eed5de3a1d4c6f46c44ab09474f800b918..8c4ed07dd8b97a7b22ec9cd4ad4a633777abaca4 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/bash -e
 
-for SCRIPT in ${@-*.cocci} ; do
+files="$(git ls-files ':/*.[ch]')"
+
+for SCRIPT in ${@-coccinelle/*.cocci} ; do
         echo "--x-- Processing $SCRIPT --x--"
         TMPFILE=`mktemp`
-        ( set -x ; spatch --sp-file $SCRIPT --dir $PWD/.. 2> "$TMPFILE" || cat "$TMPFILE" )
+        echo "+ spatch --sp-file $SCRIPT ..."
+        spatch --sp-file $SCRIPT $files 2>"$TMPFILE" || cat "$TMPFILE"
         rm "$TMPFILE"
         echo -e "--x-- Processed $SCRIPT --x--\n"
 done