-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheckIfBuildVersionsCommitted
executable file
·36 lines (28 loc) · 1.27 KB
/
checkIfBuildVersionsCommitted
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
#!/bin/bash
source config.sh
if [ ! -e DebianBuildVersions ]; then
# repository is not even there: no local changes
exit 0
fi
cd DebianBuildVersions
if [ -n "`git status --porcelain`" ]; then
echo "************************* WARNING *************************"
echo "You have still uncommitted changes in the DebianBuildVersions repository. You are not allowed to publish packages like this!"
echo "************************* WARNING *************************"
exit 1
fi
LATEST_COMMIT_ORIGIN=`git log origin/master | head -n1`
LATEST_COMMIT_LOCAL=`git log | head -n1`
if [ "${LATEST_COMMIT_ORIGIN}" != "${LATEST_COMMIT_LOCAL}" ]; then
echo "************************* WARNING *************************"
echo "You probably have not pushed your commits. You are not allowed to publish packages like this!"
echo "************************* WARNING *************************"
exit 1
fi
if [ "`git remote get-url origin`" != "${DebianBuildVersionsURI}" ]; then
echo "************************* WARNING *************************"
echo "Your DebianBuildVersions repository was cloned from a different origin. You are not allowed to publish packages like this!"
echo "************************* WARNING *************************"
exit 1
fi
exit 0