Skip to content

feat: serve non-bare repositories, add --bare-only flag#20

Open
ggueret wants to merge 1 commit into
mainfrom
feat/serve-non-bare-repos
Open

feat: serve non-bare repositories, add --bare-only flag#20
ggueret wants to merge 1 commit into
mainfrom
feat/serve-non-bare-repos

Conversation

@ggueret

@ggueret ggueret commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Serve repositories that have a working tree, not just bare ones. A new --bare-only flag keeps the previous bare-only behavior.

Context

Pointing the server at a directory of ordinary working clones (a dev workspace) discovered nothing, because discovery only recorded bare repositories. The server is read-only (git-upload-pack), so serving a working-tree repo over HTTP for clone/fetch is safe and fits the local-testing use case.

Changes

  • RepoStore::discover records any repository gix can open (bare or with a working tree) and no longer descends into a recorded repository, so a repo nested in another repo's working tree is not exposed and directories like target/ or node_modules/ are not walked.
  • New --bare-only flag (and a bare_only parameter on discover) restores discovery of bare repositories only.
  • A working-tree repo is exposed under its plain name (e.g. myproject) and clonable at /myproject.

Test plan

  • cargo test --workspace: a non-bare repo is discovered; discovery does not descend into a working tree; --bare-only skips non-bare repos; an HTTP git clone of a non-bare repo succeeds.
  • git-server ~/Projects discovers the working repos; git-server ~/Projects --bare-only discovers none.

Discovery now records any repository gix can open, not just bare ones,
so a directory of working clones can be served for clone/fetch without
converting each repo to bare. A recorded repository is no longer
descended into, which also avoids walking working-tree noise such as
target/ or node_modules/.

Pass --bare-only to restore the previous behavior of serving bare
repositories exclusively.
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