Skip to content

Discover separate-git-dir checkouts on first run #88

Closed

Description

@HemSoft

Description

First-run discovery (config::discover, crates/dashboard-core/src/config.rs:227) keeps only folders whose .git is a directory. Its comment says a .git file means a linked worktree. A primary checkout made with git init --separate-git-dir or git clone --separate-git-dir also has a .git file (gitdir: <path>), but its git directory has no commondir, so it is not a worktree.

Reproduced on b6b5450 with a synthetic temporary root on Windows (git 2.55): plain (from git init) and separate (from git init --separate-git-dir <tmp>/gitdirs/sep.git), each with an origin remote. pmd::checkout_identity reads both (hemsoft-dev/plain, hemsoft-dev/separate), but Config::load_or_create_in(dir, root) writes only plain. Control: plain is found. The existing first_run_discovers_checkouts_one_level_under_the_root_and_writes_them test in crates/dashboard-core/tests/storage.rs still correctly skips the linked worktree alpha.worktrees/pr-1.

Why

A checkout the dashboard can read is missing from the first-run list. Nothing marks the gap, so the user has to notice and add it by hand.

Goal

First-run discovery includes primary checkouts whose .git is a gitdir: file pointing at a non-worktree git directory, and still skips linked worktrees.

Acceptance Criteria

  • A direct child whose .git file points at a git directory without commondir is discovered.
  • A linked worktree (its git directory has commondir) is still skipped, as are plain folders and checkouts two levels down.
  • A .git file that is unreadable, has no gitdir: line, or points at a missing directory is skipped without panic.
  • Discovery still reads no git subprocess (dashboard-core/tests/no_child_process.rs stays green) and the result stays sorted.
  • The discover doc comment matches the new rule.

Definition of Done

  • Fix and tests in dashboard-core, using fixture folders (no git required in the test), covering the separate-git-dir, linked-worktree and malformed .git file cases.
  • cargo fmt --all --check, cargo clippy --workspace --all-targets --locked -- -D warnings, cargo test --workspace --locked and cargo deny --locked check advisories pass.
  • Clean current-head AI review.

Validation

  • cargo test -p dashboard-core --locked --test storage passes, including a case where root/separate/.git contains gitdir: <tmp>/gitdirs/sep.git (a directory with config and no commondir) and Config::load_or_create_in lists root/separate.
  • The same test still excludes root/alpha.worktrees/pr-1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions