git:checkout-worktree: s/REPO_DIR/WORKTREE_PATH/
This commit is contained in:
@@ -11,13 +11,13 @@
|
||||
# TODO: If any conflicts arise, all further shells should be interactive instead
|
||||
# of looping forever.
|
||||
|
||||
local REPO_NAME REPO_DIR
|
||||
local REPO_NAME WORKTREE_PATH
|
||||
REPO_NAME="${$(git rev-parse --show-toplevel):t}" || return
|
||||
REPO_DIR="$(mktemp -d -p "" "worktree.XXX.$REPO_NAME.$1")"
|
||||
WORKTREE_PATH="$(mktemp -d -p "" "worktree.XXX.$REPO_NAME.$1")"
|
||||
|
||||
git worktree add "$REPO_DIR" "$1"
|
||||
[[ -e "$REPO_DIR" ]] || return 1
|
||||
pushd -q "$REPO_DIR"
|
||||
git worktree add "$WORKTREE_PATH" "$1"
|
||||
[[ -e "$WORKTREE_PATH" ]] || return 1
|
||||
pushd -q "$WORKTREE_PATH"
|
||||
|
||||
# Start subshell
|
||||
"$SHELL"
|
||||
@@ -28,8 +28,8 @@ popd -q
|
||||
|
||||
# Restart the subshell until every issue is resolved and the worktree is
|
||||
# removed
|
||||
until [[ ! -e "$REPO_DIR" ]] || git worktree remove "$REPO_DIR"; do
|
||||
pushd -q "$REPO_DIR"
|
||||
until [[ ! -e "$WORKTREE_PATH" ]] || git worktree remove "$WORKTREE_PATH"; do
|
||||
pushd -q "$WORKTREE_PATH"
|
||||
"$SHELL"
|
||||
errc=$?
|
||||
popd -q
|
||||
|
||||
Reference in New Issue
Block a user