Move commit gst-indent hook to the root
[platform/upstream/gstreamer.git] / scripts / git-hooks / multi-pre-commit.hook
1 #!/bin/sh
2 # Git pre-commit hook that runs multiple hooks specified in $HOOKS.
3 # Make sure this script is executable. Bypass hooks with git commit --no-verify.
4
5 # This file is inspired by a set of unofficial pre-commit hooks available
6 # at github.
7 # Link:    https://github.com/githubbrowser/Pre-commit-hooks
8 # Contact: David Martin, david.martin.mailbox@googlemail.com
9
10
11 ###########################################################
12 # SETTINGS:
13 # pre-commit hooks to be executed. They should be in the same .git/hooks/ folder
14 # as this script. Hooks should return 0 if successful and nonzero to cancel the
15 # commit. They are executed in the order in which they are listed.
16 ###########################################################
17
18 HOOKS="scripts/git-hooks/pre-commit.hook scripts/git-hooks/pre-commit-python.hook"
19
20 # exit on error
21 set -e
22
23 echo $PWD
24
25 for hook in $HOOKS
26 do
27     echo "Running hook: $hook"
28     # run hook if it exists
29     # if it returns with nonzero exit with 1 and thus abort the commit
30     if [ -f "$PWD/$hook" ]; then
31         "$PWD/$hook"
32         if [ $? != 0 ]; then
33             exit 1
34         fi
35     else
36         echo "Error: file $hook not found."
37         echo "Aborting commit. Make sure the hook is at $PWD/$hook and executable."
38         echo "You can disable it by removing it from the list"
39         echo "You can skip all pre-commit hooks with --no-verify (not recommended)."
40         exit 1
41     fi
42 done
43