return ret;
}
+static void delete_worktrees_dir_if_empty(void)
+{
+ rmdir(git_path("worktrees")); /* ignore failed removal */
+}
+
static int prune_worktree(const char *id, struct strbuf *reason)
{
struct stat st;
}
closedir(dir);
if (!show_only)
- rmdir(git_path("worktrees"));
+ delete_worktrees_dir_if_empty();
strbuf_release(&reason);
}
* from here.
*/
ret |= delete_git_dir(wt->id);
+ delete_worktrees_dir_if_empty();
free_worktrees(worktrees);
return ret;