summaryrefslogtreecommitdiff
path: root/BitKeeper/triggers/pre-delta
blob: d6afe0905e704527b83f2a3c6882b9453c67eeb3 (plain)
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
#!/bin/sh

if [ "$BK_USER" = "Administrator" -o "$BK_USER" = "mysqldev" ]
then
 echo "Error: you cannot checkin as 'Administrator' or 'mysqldev' user."
 echo "as a workaround set BK_USER to your nickname"
 echo "e.g.: export BK_USER='bar'"
 echo ""
 echo "Checkin FAILED!"
 echo "Set BK_USER and retry."
 exit 1
fi

if [ `tail -c1 $BK_FILE` ]
then
 echo "File $BK_FILE does not end with a new-line character!"
 echo ""
 echo "Checkin FAILED!"
 echo "Fix the problem and retry."
 exit 1
fi

# detect if C/C++ files have new trailing white space
trailingblank=`echo $BK_FILE | egrep '\.(c|.h)'`
if [ -n "$trailingblank" ]
then
    trailingblank=`bk diffs $BK_FILE | grep '^> .*[[:space:]]$'`
    if [ -n "$trailingblank" ]
        then
        echo "bk diffs $BK_FILE | grep '^> .*[[:space:]]$'"
        echo "reported white space at end of some added/modified lines"
        echo ""
        echo "Checkin FAILED!"
        echo "Fix the problem and retry."
        exit 1
    fi
fi