working through git slowly
authorChris Koeritz <fred@gruntose.com>
Fri, 10 Nov 2017 14:16:25 +0000 (09:16 -0500)
committerChris Koeritz <fred@gruntose.com>
Fri, 10 Nov 2017 14:16:25 +0000 (09:16 -0500)
added code to check if branches have diverged

scripts/rev_control/version_control.sh

index c5ff3f02fd7c85df0569cea537a9248cdc8ec090..508c08a0825c808726e7334fe208d411575d6484 100644 (file)
@@ -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"