scope handling of args so as not to interfere with git magic.
@@ -11,17 +11,7 @@ then
init="true"
fi
-# Check the remote status.
cd ${TWLIGHT_HOME}
-git fetch
-
-# Only do stuff if we're behind the remote. Cribbed from stackoverflow:
-# https://stackoverflow.com/a/3278427
-upstream=${1:-'@{u}'}
-local=$(git rev-parse @)
-remote=$(git rev-parse "$upstream")
-base=$(git merge-base @ "$upstream")
-
update() {
venv_update_cmd="${TWLIGHT_HOME}/bin/./virtualenv_update.sh >>${TWLIGHT_HOME}/TWLight/logs/update.log 2>&1"
venv_test_cmd="${TWLIGHT_HOME}/bin/./virtualenv_test.sh >>${TWLIGHT_HOME}/TWLight/logs/test.log 2>&1"
@@ -48,7 +38,18 @@ if [ "${init}" = "true" ]
then
echo "Init"
update
-elif [ "${local}" = "${remote}" ]
+else
+ # Check the remote status.
+ git fetch
+
+ # Only do stuff if we're behind the remote. Cribbed from stackoverflow:
+ # https://stackoverflow.com/a/3278427
+ upstream=${1:-'@{u}'}
+ local=$(git rev-parse @)
+ remote=$(git rev-parse "$upstream")
+ base=$(git merge-base @ "$upstream")
+
+ if [ "${local}" = "${remote}" ]
then
echo "Up-to-date"
elif [ "${local}" = "${base}" ]
@@ -63,3 +64,4 @@ else
echo "Diverged"
exit 1
fi
+fi
