From eb323992dcf754e08fc5eca6e6a88b6190dc24c0 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 31 Mar 2022 15:29:53 +0200 Subject: [PATCH] git:checkout-worktree: Keep the shell's exit code Exit with the exit code of the last spawned shell. --- .config/zsh/autoload/git/git-checkout-worktree | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/zsh/autoload/git/git-checkout-worktree b/.config/zsh/autoload/git/git-checkout-worktree index 9caa16a..51f9e4b 100755 --- a/.config/zsh/autoload/git/git-checkout-worktree +++ b/.config/zsh/autoload/git/git-checkout-worktree @@ -17,6 +17,7 @@ pushd -q "$REPO_DIR" # Start subshell "$SHELL" +errc=$? # Cleanup when exiting popd -q @@ -26,8 +27,10 @@ popd -q until [[ ! -e "$REPO_DIR" ]] || git worktree remove "$REPO_DIR"; do pushd -q "$REPO_DIR" "$SHELL" + errc=$? popd -q done git worktree prune command rm -rf "$TEMP_DIR" +return $errc