Repository navigation
Git Worktrees: Fix remove worktree infinite loading spinner - #25394
Conversation
The remove worktree action shows an animated toast that never resolves when any unexpected git error occurs. The inner try/catch only handles the "untracked or modified files" case and re-throws everything else with no outer catch. The cleanup steps (removeBranch, pruneWorktrees) also run outside any try/catch. Add an outer try/catch that surfaces all errors via a failure toast instead of leaving the spinner running forever. Also quote shell-interpolated paths in removeWorktree, removeBranch, and pruneWorktrees to handle paths with spaces.
|
Thank you for your first contribution! 🎉 🔔 @philstainer you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. 📋 Quick checkout commandsBRANCH="fix/git-worktrees-remove-error-handling"
FORK_URL="https://github.com/alfredomtx/extensions-1.git"
EXTENSION_NAME="git-worktrees"
REPO_NAME="extensions-1"
git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run devWe're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days. |
Greptile SummaryAdds outer error handling to
Critical Issue: The PR description claims "Quote paths in git commands to handle paths with spaces" but only 7 out of 17 git commands with unquoted path variables were fixed. Ten additional commands in Confidence Score: 2/5
Important Files Changed
Last reviewed commit: 987e504 |
commented
Feb 12, 2026
Additional Comments (4)
|
Address review feedback: quote shell-interpolated paths in moveWorktree, renameBranch, addRemoteWorktree, and addNewWorktree for consistency with the already-quoted functions.
When a worktree directory is already gone, `git worktree remove` fails with "is not a working tree". Catch this error and skip to cleanup (prune + branch delete) instead of crashing.
commented
Feb 16, 2026
|
@greptile review |
| ## [Unreleased] | ||
|
|
||
| ### Fixed | ||
| - Fix remove worktree action showing infinite loading spinner on unexpected errors | ||
| - Quote paths in git commands to handle paths with spaces | ||
|
|
There was a problem hiding this comment.
Above changes look great, one small change that is needed here
I believe raycast changelog needs you to follow format like: ## [Fix Remove Worktree Infinite Loading] - {PR_MERGE_DATE}
commented
Feb 19, 2026
|
Hey @alfredomtx 👋 Can you please look into the failing checks? Also the incorrect changelog format. References: |
| }; | ||
|
|
||
| export const getRemoteOriginUrl = async ({ path }: { path: string }) => { | ||
| const command = `git -C ${path} remote get-url origin`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" remote get-url origin`; |
| }; | ||
|
|
||
| export const cloneBareRepository = async ({ path, url }: { path: string; url: string }) => { | ||
| return executeCommand(`git -C ${path} clone --bare "${url}" './.bare'`); |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| return executeCommand(`git -C "${path}" clone --bare "${url}" './.bare'`); |
|
|
||
| export const fetch = async (path?: string) => { | ||
| try { | ||
| const command = `git -C ${path} fetch --all --prune`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" fetch --all --prune`; |
| }; | ||
|
|
||
| export const checkIfBranchNameIsValid = async ({ path, name }: { path?: string; name: string }) => { | ||
| const command = `git -C ${path} check-ref-format --branch '${name}'`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" check-ref-format --branch '${name}'`; |
| options?: ExecOptions | undefined, | ||
| ): Promise<string[]> => { | ||
| try { | ||
| const command = `git -C ${path} branch -r`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" branch -r`; |
| includeBare?: boolean; | ||
| showCurrentWorktree?: boolean; | ||
| }) => { | ||
| const command = `git -C ${path} worktree list`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" worktree list`; |
| try { | ||
| const { skipGitHooksWhenPushing } = getPreferences(); | ||
| const noVerifyFlag = skipGitHooksWhenPushing ? " --no-verify" : ""; | ||
| const command = `git -C ${path} push --set-upstream origin ${branch}${noVerifyFlag}`; |
There was a problem hiding this comment.
path and branch variables not quoted - breaks with spaces
| const command = `git -C "${path}" push --set-upstream origin "${branch}"${noVerifyFlag}`; |
|
|
||
| export const checkIfBranchExistsOnRemote = async ({ path, branch }: { path: string; branch: string }) => { | ||
| try { | ||
| const command = `git -C ${path} ls-remote origin ${branch}`; |
There was a problem hiding this comment.
path and branch variables not quoted - breaks with spaces
| const command = `git -C "${path}" ls-remote origin "${branch}"`; |
|
|
||
| export const getCurrentCommit = async ({ path }: { path: string }) => { | ||
| try { | ||
| const command = `git -C ${path} rev-parse HEAD`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" rev-parse HEAD`; |
|
|
||
| export const pullBranchChanges = async ({ path }: { path: string }) => { | ||
| try { | ||
| const command = `git -C ${path} pull`; |
There was a problem hiding this comment.
path variable not quoted - breaks with spaces
| const command = `git -C "${path}" pull`; |
left a comment
There was a problem hiding this comment.
Awesome @alfredomtx
Thanks for taking the time to fix that issue, greatly appreciated 🙏
commented
Feb 20, 2026
|
Published to the Raycast Store: |
commented
Feb 20, 2026
|
🎉 🎉 🎉 Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@alfredomtx). Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag. |
Summary
handleRemoveWorktreeso all errors surface as a failure toast instead of spinning foreverremoveWorktree,removeBranch, andpruneWorktreesto handle paths with spacesRoot Cause
The inner try/catch in
handleRemoveWorktreeonly handles theUNTRACKED_OR_MODIFIED_FILES_ERRORcase. All other errors are re-thrown with no outer catch, causing an unhandled promise rejection — Raycast swallows these silently, leaving the animated toast spinning forever. The cleanup steps (removeBranch,pruneWorktrees) also ran outside any try/catch, so failures there caused the same issue.Test plan