-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcommit
executable file
·54 lines (44 loc) · 1.23 KB
/
commit
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
47
48
49
50
51
52
53
54
#!/bin/bash
set -e
if [ "$#" -lt 1 ]; then
echo "$0 <message> [--test]"
exit 1
fi
MESSAGE=$1
NO_DCH=0
if [[ $MESSAGE == !* ]] ; then
MESSAGE="${MESSAGE:1}"
NO_DCH=1
fi
if [ -n "$(git diff)" ] || [ "$2" == "--test" ] ; then
CHANGELOG=$(dpkg-parsechangelog)
set +e
grep -c '^ --' debian/changelog | grep -q "^1$"
ONE_ENTRY=$?
echo "$CHANGELOG" | grep -q '^Distribution: UNRELEASED$'
UNRELEASED=$?
echo "$CHANGELOG" | grep '^ ' | sed 's/ \* //' | grep -F -q "$MESSAGE"
PRESENT=$?
set -e
if ! (
([ $UNRELEASED -eq 0 ] && [ $PRESENT -eq 0 ]) || \
([ $ONE_ENTRY -eq 0 ] && [ $UNRELEASED -eq 0 ])
) && [ $NO_DCH -eq 0 ] ; then
MAINTAINER=$(grep-dctrl -n -F Maintainer '' -s Maintainer debian/control || true)
case $MAINTAINER in
*debian-multimedia@lists.debian.org*) ;;
*pkg-multimedia-maintainers@lists.alioth.debian.org*) ;;
*pkg-salt-team@lists.alioth.debian.org*) ;;
*)
dch --no-auto-nmu "$MESSAGE."
;;
esac
fi
if [ "$2" != "--test" ] ; then
git add debian/
git commit -m "$MESSAGE"
git --no-pager show
fi
exit 0
fi
exit 1