96347fee28874abab4f1b1095021e9cf9a46fc33
[invirt/scripts/git-hooks.git] / sub / update
1 #!/bin/sh
2
3 ref="$1"
4 oldrev="$2"
5 newrev="$3"
6
7 # --- Safety check
8
9 if [ -z "$GIT_DIR" ]; then
10         echo "Don't run this script from the command line." >&2
11         echo " (if you want, you could supply GIT_DIR then run" >&2
12         echo "  $0 <ref> <oldrev> <newrev>)" >&2
13         exit 1
14 fi
15
16 if [ -z "$ref" -o -z "$oldrev" -o -z "$newrev" ]; then
17         echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
18         exit 1
19 fi
20
21 # --- Disallow pushing tags
22
23 case "$ref" in
24     refs/heads/*)
25         ;;
26     *)
27         echo "*** Pushing non-branches to this repository is not allowed" >&2
28         exit 1
29         ;;
30 esac