From 12b74c38e2785a9e9503894e585722900882a056 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 7 Jun 2018 15:07:14 +0200 Subject: [PATCH] tools: make various scripts find the top-levle git dir automatically --- coccinelle/run-coccinelle.sh | 3 ++- tools/find-double-newline.sh | 6 ++++-- tools/find-tabs.sh | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/coccinelle/run-coccinelle.sh b/coccinelle/run-coccinelle.sh index 4c8c08227b..a18da58a3e 100755 --- a/coccinelle/run-coccinelle.sh +++ b/coccinelle/run-coccinelle.sh @@ -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 ..." diff --git a/tools/find-double-newline.sh b/tools/find-double-newline.sh index 6e7e4cb699..6a6790b4b2 100755 --- a/tools/find-double-newline.sh +++ b/tools/find-double-newline.sh @@ -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 diff --git a/tools/find-tabs.sh b/tools/find-tabs.sh index 611931c4b5..e32eac8f32 100755 --- a/tools/find-tabs.sh +++ b/tools/find-tabs.sh @@ -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