From: Chris Koeritz Date: Fri, 10 Nov 2017 14:16:25 +0000 (-0500) Subject: working through git slowly X-Git-Tag: 2.140.90^2~4 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=020a35fd377832491d1fa05ef807638bda5b6619;p=feisty_meow.git working through git slowly added code to check if branches have diverged --- diff --git a/scripts/rev_control/version_control.sh b/scripts/rev_control/version_control.sh index c5ff3f02..508c08a0 100644 --- a/scripts/rev_control/version_control.sh +++ b/scripts/rev_control/version_control.sh @@ -281,17 +281,18 @@ function do_update() test_or_die "git remote update" # from: https://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git -UPSTREAM="${1:-'@{u}'}" +UPSTREAM=$(parent_branch_name) +#argh: original UPSTREAM='${1:-'\''@{u}'\''}' LOCAL=$(git rev-parse @) REMOTE=$(git rev-parse "$UPSTREAM") BASE=$(git merge-base @ "$UPSTREAM") var UPSTREAM LOCAL REMOTE BASE -if [ $LOCAL = $REMOTE ]; then +if [ "$LOCAL" == "$REMOTE" ]; then echo "Up-to-date" -elif [ $LOCAL = $BASE ]; then +elif [ "$LOCAL" == "$BASE" ]; then echo "Need to pull" -elif [ $REMOTE = $BASE ]; then +elif [ "$REMOTE" == "$BASE" ]; then echo "Need to push" else echo "Diverged"