Skip to content

Worktree mode leaves partial state on disk when post-clone steps fail #73

Description

@Boomatang

Description

The worktree() function in src/main.zig performs a multi-step setup:

  1. grab.clone() -- creates a bare clone directory
  2. grab.linkGit() -- creates a .git file
  3. grab.setupOrigin() -- configures the remote
  4. grab.fetchOrigin() -- fetches from origin

If step 1 succeeds but any subsequent step fails, the function returns an error and the caller moves on to the next repo. The bare clone directory is left on disk in a half-configured state.

On a subsequent run, grab.clone() will return error.exists ("path not empty") and the repo can never be successfully set up without manual cleanup by the user.

Expected Behavior

Either:

  • Clean up the partially-created directory on failure (rollback), or
  • Detect the partial state on subsequent runs and resume setup from where it left off, or
  • At minimum, log a warning telling the user that manual cleanup may be needed at the specific path

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions