From 641a339c48bc205b9a1c6b6e075a1e6ebbef9257 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 2 Sep 2019 23:07:03 +0200 Subject: [PATCH] Fixed error in logic: commit hashes must be set after fetch, not before. --- startup.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/startup.sh b/startup.sh index 1194ca1..2bacebb 100755 --- a/startup.sh +++ b/startup.sh @@ -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"