summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2022-03-23 21:46:23 +0100
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2022-04-05 08:28:50 +0000
commit7604c7b08888487c797002ad8c141793cb3f91c1 (patch)
treea418e5a35d2c4a41232acb9608bfd4d3627bd00b /scripts
parent6ddb4437430c4258a43beb2e59cbff2a4f48ab4a (diff)
downloadgstreamer-7604c7b08888487c797002ad8c141793cb3f91c1.tar.gz
csharp: check format in the pre-commit hook
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/983>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/git-hooks/pre-commit.hook24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/git-hooks/pre-commit.hook b/scripts/git-hooks/pre-commit.hook
index 3c1062b9e0..1224ffd3d9 100755
--- a/scripts/git-hooks/pre-commit.hook
+++ b/scripts/git-hooks/pre-commit.hook
@@ -80,4 +80,28 @@ echo "==========================================================================
exit 1
fi
done
+
+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`
+ 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."
+ exit 1
+ fi
+ scripts/format-csharp --check
+ r=$?
+ if [ $r != 0 ] ; then
+echo "================================================================================================="
+echo " Code style error: "
+echo " "
+echo " Please fix before committing, running from the top-level directory: "
+echo " scripts/format-chsarp "
+echo " "
+echo " Don't forget to run git add before trying to commit again. "
+echo "================================================================================================="
+ exit 1
+ fi
+fi
+
echo "--Checking style pass--"