forked from pwithnall/dbus-deviation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-push.hook
46 lines (37 loc) · 1.15 KB
/
pre-push.hook
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
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# A hook script to update the D-Bus API signature database every time a release
# tag is pushed. See the git-hooks documentation for the parameters it’s called
# with. See $(top_srcdir)/dbus-deviation.mk for more information about how this
# project uses dbus-deviation to check D-Bus API stability.
#
# If the API signature database is updated, a git note will be added to the new
# tag for each D-Bus API in the project, and the notes will be pushed remotely.
remote="$1"
url="$2"
# Get the configuration from the Makefile.
# This is pretty terrible.
eval `make dbus-deviation-mk-config`
if [ "$GIT" == "" ]; then
GIT=git
fi
if [ "$GIT_DIR" == "" ]; then
GIT_DIR=`git rev-parse --git-dir`
fi
if [ "$GIT_WORK_TREE" == "" ]; then
GIT_WORK_TREE=`pwd`
fi
IFS=' '
while read local_ref local_sha remote_ref remote_sha; do
if ! $GIT rev-parse --verify $local_ref^{tag} &> /dev/null; then
continue
fi
# Ignore failures from this.
dbus-interface-vcs-helper \
--git "$GIT" \
--git-dir "$GIT_DIR" \
--git-work-tree "$GIT_WORK_TREE" \
--git-refs "$dbus_api_git_refs" \
--git-remote "$remote" \
dist --ignore-existing $dbus_api_xml_files
done
exit 0