diff --git a/scripts/git-hooks/pre-commit.hook b/scripts/git-hooks/pre-commit.hook index 3b9b5c3708..aa4fb6758d 100755 --- a/scripts/git-hooks/pre-commit.hook +++ b/scripts/git-hooks/pre-commit.hook @@ -7,11 +7,11 @@ # On some *bsd systems the binary seems to be called gnunindent, # so check for that first. -version=`gnuindent --version 2>/dev/null` +version=$(gnuindent --version 2>/dev/null) if test "x$version" = "x"; then - version=`gindent --version 2>/dev/null` + version=$(gindent --version 2>/dev/null) if test "x$version" = "x"; then - version=`indent --version 2>/dev/null` + version=$(indent --version 2>/dev/null) if test "x$version" = "x"; then echo "GStreamer git pre-commit hook:" echo "Did not find GNU indent, please install it before continuing." @@ -26,7 +26,7 @@ else INDENT=gnuindent fi -case `$INDENT --version` in +case $($INDENT --version) in GNU*) ;; default) @@ -52,11 +52,11 @@ INDENT_PARAMETERS="--braces-on-if-line \ --leave-preprocessor-space" echo "--Checking style--" -for file in `git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "\.c$"` ; do +for file in $(git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "\.c$") ; do # nf is the temporary checkout. This makes sure we check against the # revision in the index (and not the checked out version). - nf=`git checkout-index --temp ${file} | cut -f 1` - newfile=`mktemp /tmp/${nf}.XXXXXX` || exit 1 + nf=$(git checkout-index --temp ${file} | cut -f 1) + newfile=$(mktemp /tmp/${nf}.XXXXXX) || exit 1 $INDENT ${INDENT_PARAMETERS} \ $nf -o $newfile 2>> /dev/null # FIXME: Call indent twice as it tends to do line-breaks @@ -91,9 +91,9 @@ echo "========================================================================== exit 1 fi -csharp_files=` git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "^subprojects/gstreamer-sharp/.*cs$" ` +csharp_files=$( git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "^subprojects/gstreamer-sharp/.*cs$" ) if test "x$csharp_files" != "x"; then - version=`dotnet-format --version 2>/dev/null` + version=$(dotnet-format --version 2>/dev/null) if test "x$version" = "x"; then echo "GStreamer git pre-commit hook:" echo "Did not find dotnet-format required to format C# files, please install it before continuing."