diff --git a/source/cydo/worktree.d b/source/cydo/worktree.d index 4574c9d..5b9b2b2 100644 --- a/source/cydo/worktree.d +++ b/source/cydo/worktree.d @@ -17,6 +17,14 @@ private enum ArchiveRefState private ArchiveRefState getArchiveRefState(string projectPath, int tid) { + // a non-git projectPath (e.g. an "unrestricted" workspace rooted at a plain + // directory like $HOME) can't hold an archive ref at all; rev-parse would + // bail with "not a git repository" (exit 128), so resolve to Missing before + // the strict status check below treats non-0/1 exits as genuine git failures + auto insideWorkTree = execute(["git", "-C", projectPath, "rev-parse", "--is-inside-work-tree"]); + if (insideWorkTree.status != 0) + return ArchiveRefState.Missing; + auto refName = format!"refs/cydo/worktree-archive/%d"(tid); auto cmd = ["git", "-C", projectPath, "rev-parse", "--verify", "--quiet", refName]; auto result = execute(cmd);