We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 697e1e6 commit 2a77ea5Copy full SHA for 2a77ea5
git/hooks/pre-commit
@@ -0,0 +1,27 @@
1
+#!/bin/bash
2
+
3
+set -eu
4
5
+function timed_run() {
6
+ description=$1
7
+ command=$2
8
+ timer=$(date +%s)
9
10
+ $command
11
+ exit_code=$?
12
+ timer=$(($(date +%s) - timer))
13
14
+ verbose=${MM_VERBOSE_HOOKS:-0}
15
16
+ if [ "$verbose" == "1" ]; then
17
+ echo "ℹ️ $description - $timer seconds"
18
+ echo "exit code: $exit_code"
19
+ fi
20
21
+ if [ $exit_code -ne 0 ]; then
22
+ echo "ℹ️ $description - failed"
23
+ exit $exit_code
24
25
+}
26
27
+timed_run "local/precious lint" "local/precious lint --staged"
git/setup.sh
@@ -0,0 +1,7 @@
+chmod +x git/hooks/*
+cd .git/hooks || exit
+rm -f pre-commit.sample
+ln -s ../../git/hooks/pre-commit .
+git config --local core.hooksPath .git/hooks
0 commit comments