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