Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions source/cydo/worktree.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down