From 020a35fd377832491d1fa05ef807638bda5b6619 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 10 Nov 2017 09:16:25 -0500 Subject: [PATCH] working through git slowly added code to check if branches have diverged --- scripts/rev_control/version_control.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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" -- 2.34.1