git:checkout-worktree: Fix exit when not in repo
Fix the exit condition when the function is called outside of a git repository. Use zsh's `:t` History Expansion Modifier, as `$?` does not keep `git rev-parse`'s exit code, but rather `basename`'s.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
# (e.g. stashing). Finally the temporary directory is deleted.
|
||||
|
||||
local GIT_ROOT TEMP_DIR REPO_DIR
|
||||
GIT_ROOT="$(basename "$(git rev-parse --show-toplevel)")" || return
|
||||
GIT_ROOT="${$(git rev-parse --show-toplevel):t}" || return
|
||||
TEMP_DIR="$(mktemp -d)"
|
||||
REPO_DIR="$TEMP_DIR/$GIT_ROOT"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user