File: pre-commit

package info (click to toggle)
metastore 1-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 128 kB
  • ctags: 108
  • sloc: ansic: 1,162; sh: 55; makefile: 38
file content (34 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#
# An example hook script to store metadata information using
# metastore on each commit. A verification message with a list
# of changes will first be shown and only if it is accepted will
# the commit proceed.

echo "Going to commit the following metadata changes" >&2
metastore -c -m >&2
echo -n "Ok to commit? (y/n): " >&2
read -n1 REPLY
echo ""

if [ "$REPLY" != "y" ]; then
	echo "Aborted" >&2
	exit 1
fi

if ! metastore -s; then
	echo "Failed to execute metastore -s" >&2
	exit 1
fi

if [ ! -e ".metadata" ]; then
	echo ".metadata missing" >&2
	exit 1
fi

if ! git-add .metadata; then
	echo "Failed to execute git-add .metadata" >&2
	exit 1
fi

exit 0