Fixed error in logic: commit hashes must be set after fetch, not before.

This commit is contained in:
Michael 2019-09-02 23:07:03 +02:00
parent 7f7dc3f802
commit 641a339c48

View file

@ -6,10 +6,7 @@ SCRIPTPATH=$(dirname "$SCRIPT")
SCRIPTNAME="$0"
ARGS="$@"
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @) #Hash of the current local commit (@ is a git shorthand)
REMOTE=$(git rev-parse "$UPSTREAM") #Hash of the current upstream commit
BASE=$(git merge-base @ "$UPSTREAM") #Hash of the commit at which the current branch and its upstream diverge
self_update() {
@ -18,6 +15,11 @@ self_update() {
cd $SCRIPTPATH
git fetch
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @) #Hash of the current local commit (@ is a git shorthand)
REMOTE=$(git rev-parse "$UPSTREAM") #Hash of the current upstream commit
BASE=$(git merge-base @ "$UPSTREAM") #Hash of the commit at which the current branch and its upstream diverge
if [ $LOCAL = $REMOTE ]; then
echo "Repo is Up-to-date"