Merge pull request #129 from devdua/revise-helk-update

Minor improvement to update check
keyword-vs-text-changes
Roberto Rodriguez 2018-12-10 09:10:56 +03:00 committed by GitHub
commit bb9946331f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -85,6 +85,9 @@ check_github(){
git remote update >> $LOGFILE 2>&1
COMMIT_DIFF=$(git rev-list --count master...helk-repo/master)
CURRENT_COMMIT=$(git rev-parse HEAD)
REMOTE_LATEST_COMMIT=$(git rev-parse helk-repo/master)
echo "HEAD commits --> Current: $CURRENT_COMMIT | Remote: $REMOTE_LATEST_COMMIT" >> $LOGFILE 2>&1
if [ ! "$COMMIT_DIFF" == "0" ]; then
echo "Possibly new release available. Commit diff --> $COMMIT_DIFF" >> $LOGFILE 2>&1
@ -93,7 +96,9 @@ check_github(){
if [[ -z $IS_MASTER_BEHIND ]]; then
echo "Current master branch ahead of remote branch. Exiting..." >> $LOGFILE 2>&1
echo "[HELK-UPDATE-INFO] No updates available."
else
elif [ ! "$CURRENT_COMMIT" == "$REMOTE_LATEST_COMMIT" ]; then
echo "Difference in HEAD commits --> Current: $CURRENT_COMMIT | Remote: $REMOTE_LATEST_COMMIT" >> $LOGFILE 2>&1
echo "[HELK-UPDATE-INFO] New release available. Pulling new code."
git checkout master >> $LOGFILE 2>&1
git pull helk-repo master >> $LOGFILE 2>&1