From d72d79d85a77fc234973c471df2ef4fd6ef38ada Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Tue, 16 Apr 2024 11:33:44 +0300 Subject: [PATCH] pre-commit: Avoid prefixing string comparissons with x This was working around bugs in various shells, but this problem has been fixed for a decade now. https://www.shellcheck.net/wiki/SC2268 Part-of: --- scripts/git-hooks/pre-commit.hook | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/git-hooks/pre-commit.hook b/scripts/git-hooks/pre-commit.hook index aa4fb6758d..d5d7ba2eba 100755 --- a/scripts/git-hooks/pre-commit.hook +++ b/scripts/git-hooks/pre-commit.hook @@ -8,11 +8,11 @@ # so check for that first. version=$(gnuindent --version 2>/dev/null) -if test "x$version" = "x"; then +if test -z "$version"; then version=$(gindent --version 2>/dev/null) - if test "x$version" = "x"; then + if test -z "$version"; then version=$(indent --version 2>/dev/null) - if test "x$version" = "x"; then + if test -z "$version"; then echo "GStreamer git pre-commit hook:" echo "Did not find GNU indent, please install it before continuing." exit 1 @@ -92,9 +92,9 @@ echo "========================================================================== fi csharp_files=$( git diff-index --cached --name-only HEAD --diff-filter=ACMR| grep "^subprojects/gstreamer-sharp/.*cs$" ) -if test "x$csharp_files" != "x"; then +if test -n "$csharp_files"; then version=$(dotnet-format --version 2>/dev/null) - if test "x$version" = "x"; then + if test -z "$version"; then echo "GStreamer git pre-commit hook:" echo "Did not find dotnet-format required to format C# files, please install it before continuing." exit 1