]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coccinelle: add option to make changes in place
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 20 Apr 2018 13:21:06 +0000 (15:21 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 4 Jun 2018 09:48:52 +0000 (11:48 +0200)
coccinelle/run-coccinelle.sh

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