git:checkout-worktree: Keep the shell's exit code
Exit with the exit code of the last spawned shell.
This commit is contained in:
@@ -17,6 +17,7 @@ pushd -q "$REPO_DIR"
|
|||||||
|
|
||||||
# Start subshell
|
# Start subshell
|
||||||
"$SHELL"
|
"$SHELL"
|
||||||
|
errc=$?
|
||||||
|
|
||||||
# Cleanup when exiting
|
# Cleanup when exiting
|
||||||
popd -q
|
popd -q
|
||||||
@@ -26,8 +27,10 @@ popd -q
|
|||||||
until [[ ! -e "$REPO_DIR" ]] || git worktree remove "$REPO_DIR"; do
|
until [[ ! -e "$REPO_DIR" ]] || git worktree remove "$REPO_DIR"; do
|
||||||
pushd -q "$REPO_DIR"
|
pushd -q "$REPO_DIR"
|
||||||
"$SHELL"
|
"$SHELL"
|
||||||
|
errc=$?
|
||||||
popd -q
|
popd -q
|
||||||
done
|
done
|
||||||
|
|
||||||
git worktree prune
|
git worktree prune
|
||||||
command rm -rf "$TEMP_DIR"
|
command rm -rf "$TEMP_DIR"
|
||||||
|
return $errc
|
||||||
|
|||||||
Reference in New Issue
Block a user