]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tools: make various scripts find the top-levle git dir automatically
authorLennart Poettering <lennart@poettering.net>
Thu, 7 Jun 2018 13:07:14 +0000 (15:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Jun 2018 14:22:16 +0000 (16:22 +0200)
coccinelle/run-coccinelle.sh
tools/find-double-newline.sh
tools/find-tabs.sh

index 4c8c08227bbfa63fe803d07fc5bc40a05eb2de4a..a18da58a3ec468eb69d271feda07b394a77cf250 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/bash -e
 
+top="$(git rev-parse --show-toplevel)"
 files="$(git ls-files ':/*.[ch]')"
 args=
 
@@ -10,7 +11,7 @@ case "$1" in
                 ;;
 esac
 
-for SCRIPT in ${@-coccinelle/*.cocci} ; do
+for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do
         echo "--x-- Processing $SCRIPT --x--"
         TMPFILE=`mktemp`
         echo "+ spatch --sp-file $SCRIPT $args ..."
index 6e7e4cb6996259e4c65a031cbed14e5e5e0e56e3..6a6790b4b2ab1eda8e53f47f450fbd711f959687 100755 (executable)
@@ -1,11 +1,13 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1+
 
+TOP=`git rev-parse --show-toplevel`
+
 case "$1" in
 
         recdiff)
                 if [ "$2" = "" ] ; then
-                        DIR="$PWD/.."
+                        DIR="$TOP"
                 else
                         DIR="$2"
                 fi
@@ -15,7 +17,7 @@ case "$1" in
 
         recpatch)
                 if [ "$2" = "" ] ; then
-                        DIR="$PWD/.."
+                        DIR="$TOP"
                 else
                         DIR="$2"
                 fi
index 611931c4b5a2465211c87e650b4e7a23e443c018..e32eac8f3297848bc3692ec26a01e02b2d1a6685 100755 (executable)
@@ -1,11 +1,13 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1+
 
+TOP=`git rev-parse --show-toplevel`
+
 case "$1" in
 
         recdiff)
                 if [ "$2" = "" ] ; then
-                        DIR="$PWD/.."
+                        DIR="$TOP"
                 else
                         DIR="$2"
                 fi
@@ -15,7 +17,7 @@ case "$1" in
 
         recpatch)
                 if [ "$2" = "" ] ; then
-                        DIR="$PWD/.."
+                        DIR="$TOP"
                 else
                         DIR="$2"
                 fi