fix: always cd to home after dotstate_update
This commit is contained in:
@@ -18,15 +18,14 @@ dotstate_update() {
|
||||
[[ "$(id -u)" -ne "$(stat -c '%u' "$TARGET_DIR" 2>/dev/null)" ]] && return 0
|
||||
[[ ! -d "$TARGET_DIR/.git" ]] && return 0
|
||||
|
||||
local orig_dir="$PWD"
|
||||
cd "$TARGET_DIR" || return 0
|
||||
|
||||
local remote_sha local_sha
|
||||
remote_sha=$(timeout 5 git ls-remote "$REPO_URL" HEAD | awk '{print $1}')
|
||||
[[ -z "$remote_sha" ]] && { cd "$orig_dir"; return 0; }
|
||||
[[ -z "$remote_sha" ]] && { cd ~; return 0; }
|
||||
local_sha=$(git rev-parse HEAD)
|
||||
if [[ "$remote_sha" == "$local_sha" ]]; then
|
||||
cd "$orig_dir"
|
||||
cd ~
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user