tools: make various scripts find the top-levle git dir automatically

This commit is contained in:
Lennart Poettering 2018-06-07 15:07:14 +02:00
parent b47837ac41
commit 12b74c38e2
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,6 @@
#!/bin/bash -e #!/bin/bash -e
top="$(git rev-parse --show-toplevel)"
files="$(git ls-files ':/*.[ch]')" files="$(git ls-files ':/*.[ch]')"
args= args=
@ -10,7 +11,7 @@ case "$1" in
;; ;;
esac esac
for SCRIPT in ${@-coccinelle/*.cocci} ; do for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do
echo "--x-- Processing $SCRIPT --x--" echo "--x-- Processing $SCRIPT --x--"
TMPFILE=`mktemp` TMPFILE=`mktemp`
echo "+ spatch --sp-file $SCRIPT $args ..." echo "+ spatch --sp-file $SCRIPT $args ..."

View File

@ -1,11 +1,13 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: LGPL-2.1+ # SPDX-License-Identifier: LGPL-2.1+
TOP=`git rev-parse --show-toplevel`
case "$1" in case "$1" in
recdiff) recdiff)
if [ "$2" = "" ] ; then if [ "$2" = "" ] ; then
DIR="$PWD/.." DIR="$TOP"
else else
DIR="$2" DIR="$2"
fi fi
@ -15,7 +17,7 @@ case "$1" in
recpatch) recpatch)
if [ "$2" = "" ] ; then if [ "$2" = "" ] ; then
DIR="$PWD/.." DIR="$TOP"
else else
DIR="$2" DIR="$2"
fi fi

View File

@ -1,11 +1,13 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: LGPL-2.1+ # SPDX-License-Identifier: LGPL-2.1+
TOP=`git rev-parse --show-toplevel`
case "$1" in case "$1" in
recdiff) recdiff)
if [ "$2" = "" ] ; then if [ "$2" = "" ] ; then
DIR="$PWD/.." DIR="$TOP"
else else
DIR="$2" DIR="$2"
fi fi
@ -15,7 +17,7 @@ case "$1" in
recpatch) recpatch)
if [ "$2" = "" ] ; then if [ "$2" = "" ] ; then
DIR="$PWD/.." DIR="$TOP"
else else
DIR="$2" DIR="$2"
fi fi