Do not commit if there are uncommited changes in apache config directory
authorZachary Seguin <ztseguin@csclub.uwaterloo.ca>
Tue, 2 Feb 2016 04:52:44 +0000 (23:52 -0500)
committerZachary Seguin <ztseguin@csclub.uwaterloo.ca>
Tue, 2 Feb 2016 04:52:44 +0000 (23:52 -0500)
expire-sites

index 855b8bf..2edb0f2 100755 (executable)
@@ -33,6 +33,16 @@ echo 'Checking for changes'
 git diff --name-only --exit-code ${CONFIGFILE} > /dev/null
 
 if [ $? -ne 0 ]; then
+   echo 'Checking for uncommited changes'
+   git diff --name-only --exit-code > /dev/null
+
+   if [ $? -ne 0 ]; then
+      echo "There are uncommited changes in ${APACHEDIR}." >&2
+      echo "Sincerely yours," >&2
+      echo "$(hostname)" >&2
+      exit 1
+   fi
+
    echo 'Changes detected: Commiting updated configuration'
    git add ${CONFIGFILE}
    git commit -m '[CRON] Updated list of expired sites'