diff --git a/rc_shared.sh b/rc_shared.sh index 216eea5..cabe9a3 100644 --- a/rc_shared.sh +++ b/rc_shared.sh @@ -108,13 +108,13 @@ project="$HOME/.env-shared" function update-shared2 { if [[ -d $project ]]; then log "`date` - Updating '$project'.\n" - cd "$project" - git switch "$branch" - git pull --recurse-submodules + git -C "$project" switch "$branch" + git -C "$project" pull --recurse-submodules || \ + ( echo "Failed to pull project, exiting." && return 1 ) else log "`date` - Downloading '$project'.\n" git clone https://git.hyperling.com/me/env-shared \ - $project --branch=$branch + "$project" --branch=$branch fi local_bin="$HOME/bin" @@ -138,8 +138,8 @@ function update-shared2 { alias shared-update2="update-shared2" alias reload-shared2="update-shared2" alias shared-reload2="update-shared2" -( if [[ -d $project ]]; then - git -C $project fetch >/dev/null 2>&1 && git -C $project status | grep "is behind" \ +( if [[ -d "$project" ]]; then + git -C "$project" fetch >/dev/null 2>&1 && git -C "$project" status | grep "is behind" \ | while read status; do log "\n\n`date` - Updates to env-shared are available via 'update-shared2'." log " '$status'"