git:checkout-worktree: Echo non-zero exit code

This commit is contained in:
2025-01-29 14:26:31 +01:00
parent 558bb0582e
commit c8c9d887f5

View File

@@ -54,12 +54,14 @@ trap '
pushd -q "$WORKTREE_PATH"
"$SHELL" && errc=$? || errc=$?
(( !errc )) || echo "shell exited with $errc"
# Restart the shell (forcefully interactive) until the worktree is removed
until [[ ! -e "$WORKTREE_PATH" ]] || git worktree remove "$WORKTREE_PATH"; do
[[ -t 0 ]] ||
>&2 printf "Dropping into interactive shell to resolve conflicts\n"
"$SHELL" -i && errc=$? || errc=$?
(( !errc )) || echo "shell exited with $errc"
done
# Reset traps and PWD