Skip to content

Support opening bare repositories - #94

Open
mjc wants to merge 3 commits into
asinglebit:mainfrom
mjc:mjc/skip-workdir-status
Open

Support opening bare repositories#94
mjc wants to merge 3 commits into
asinglebit:mainfrom
mjc:mjc/skip-workdir-status

Conversation

@mjc

@mjc mjc commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

This lets guitar open bare repositories for history browsing without a working tree. Repository loads now derive worktree capability from the currently opened git2::Repository, so reloading or switching repositories cannot leave stale bare/worktree state behind.

The same change keeps workdir status collection on libgit2's recursive status entries, rather than expanding untracked directories through filesystem paths and re-querying each child. That avoids path re-resolution problems on case-insensitive filesystems when a repo contains case-colliding filenames from another platform.

A better way to do this in the future would be to move toward more of a state machine than a bunch of bools.

Details

  • Detect missing worktrees from the opened repository instead of a sticky app-level startup mode.
  • Model command availability through Command::required_capability() and current repository worktree support.
  • Treat repositories without a worktree as having no workdir status result at the query boundary, then show an empty uncommitted-change view.
  • Keep Git identity loading independent of worktree availability.
  • Block worktree-mutating actions when the current repository has no worktree.
  • Preserve conflict and submodule status handling while using recursive status entries for untracked directories.

Details

  • Detect bare repositories from the opened repository instead of a sticky app-level mode flag.
  • Model command availability through Command::required_capability() and current repository worktree support.
  • Treat repositories without a worktree as having no uncommitted-change result at the query boundary, so graph/history browsing can load cleanly.
  • Keep Git identity loading independent of worktree availability.
  • Block worktree-mutating actions when the current repository has no worktree.
  • Preserve conflict and submodule status handling while using recursive status entries for untracked directories.

Tests

  • cargo test bare_repo -- --nocapture
  • cargo test unavailable_worktree_blocks_worktree_commands_before_dispatch -- --nocapture
  • cargo test reload_refreshes_worktree_state_for_new_repository -- --nocapture
  • cargo test workdir_diff -- --nocapture

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant