summaryrefslogtreecommitdiffstats
path: root/third_party/rust/cubeb-coreaudio/.githooks
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/cubeb-coreaudio/.githooks
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/cubeb-coreaudio/.githooks')
-rwxr-xr-xthird_party/rust/cubeb-coreaudio/.githooks/pre-push47
1 files changed, 47 insertions, 0 deletions
diff --git a/third_party/rust/cubeb-coreaudio/.githooks/pre-push b/third_party/rust/cubeb-coreaudio/.githooks/pre-push
new file mode 100755
index 0000000000..288a2353fc
--- /dev/null
+++ b/third_party/rust/cubeb-coreaudio/.githooks/pre-push
@@ -0,0 +1,47 @@
+#!/bin/bash -e
+
+# An example hook script to verify what is about to be pushed. Called by "git
+# push" after it has checked the remote status, but before anything has been
+# pushed. If this script exits with a non-zero status nothing will be pushed.
+#
+# This hook is called with the following parameters:
+#
+# $1 -- Name of the remote to which the push is being done
+# $2 -- URL to which the push is being done
+#
+# If pushing without using a named remote those arguments will be equal.
+#
+# Information about the commits which are being pushed is supplied as lines to
+# the standard input in the form:
+#
+# <local ref> <local sha1> <remote ref> <remote sha1>
+
+REMOTE="$1"
+URL="$2"
+
+PUSH_COMMAND=$(ps -ocommand= -p $PPID)
+
+IS_DESTRUCTIVE="\-\-delete|\-f"
+
+PROTECTED_BRANCH="trailblazer"
+CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
+
+WILL_DELETE_PROTECTED_BRANCH=":$PROTECTED_BRANCH"
+
+if [[ $PUSH_COMMAND =~ $IS_DESTRUCTIVE ]]; then
+ if [ $CURRENT_BRANCH = $PROTECTED_BRANCH ] || [[ $PUSH_COMMAND =~ $PROTECTED_BRANCH ]]; then
+ echo "'$PROTECTED_BRANCH' cannot be deleted!"
+ exit 1
+ fi
+ exit 0
+fi
+
+if [[ $PUSH_COMMAND =~ $WILL_DELETE_PROTECTED_BRANCH ]]; then
+ echo "'$PROTECTED_BRANCH' cannot be deleted!"
+ exit 1
+fi
+
+cargo fmt -- --check || (echo "Please run 'cargo fmt'"; false);
+
+cargo clippy -- -D warnings || (echo "Please run 'cargo clippy'"; false);
+