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" SCRIPTNAME="$0"
ARGS="$@" 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() { self_update() {
@ -19,6 +16,11 @@ self_update() {
cd $SCRIPTPATH cd $SCRIPTPATH
git fetch 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 if [ $LOCAL = $REMOTE ]; then
echo "Repo is Up-to-date" echo "Repo is Up-to-date"