Skip to content

Archive fails when worktree was deleted externally #1798

@charlesvien

Description

@charlesvien

Context

Reported by haacked in Slack. Edge case but worth fixing.

Problem

When a workspace's worktree has been deleted by an external process (e.g. manual cleanup on the command line), clicking the archive button causes the task to flash, it briefly disappears then reappears. The archive operation fails because it tries to capture a checkpoint in a directory that is no longer a git repository.

Error from dev console:

Failed to archive task TRPCClientError: Failed to capture checkpoint: fatal: not a git repository (or any of the parent directories): .git

Expected behavior

If the worktree no longer exists or is not a valid git repository, the archive should skip the checkpoint step and continue with the remaining archive steps.

Steps to reproduce

  1. Have a workspace with an associated worktree
  2. Delete the worktree externally (e.g. rm -rf the worktree directory)
  3. Click the archive button on the workspace
  4. Observe the task flashes and does not archive

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingWorktreeThis issue is related to worktrees

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions