mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 23:18:24 +00:00
Adds the `/prs/<npub>/<identifier>.git/*` URL space behind the existing
`NGIT_GRASP06_ENABLE` flag. Fetches synthesise an empty bare repo per
request (via `git init --bare` in a tempdir) when no real repo exists
on disk; if a real repo exists at `<git_data_path>/prs/<hex>/<id>.git`
it delegates to the standard `handle_info_refs` / `handle_upload_pack`.
The receive-pack endpoint is a deliberate stub that returns HTTP 200
with an ERR pkt-line ("GRASP-06 receive-pack not yet implemented"),
matching `build_git_protocol_error_response`'s shape so git clients
print the message and exit non-zero rather than seeing a 404. The real
receive-pack handler is not yet implemented.
Module layout under `src/grasp06/`:
paths.rs — PRS_URL_PREFIX, PRS_DISK_PREFIX, prs_repo_path,
prs_base_path, is_prs_repo_path (hex on disk).
endpoint.rs — PrsUrl + parse_prs_url (npub-only, percent-decoded id).
fetch.rs — handle_prs_info_refs, handle_prs_upload_pack, and the
receive-pack stub.
Routing is wired into HttpService::call ahead of `parse_git_url` so
`/prs/...` paths can't be misclassified as standard owner repos. When
the flag is off the branch is skipped and `/prs/*` falls through to
the existing 404 path (preserving the discovery-gate contract).
Tests flipped green:
- prs_fetch_unknown_path_serves_empty_repo_with_grasp_06
- prs_push_other_refs_rejected_with_grasp_06 (ERR pkt-line)
- standard_push_does_not_mirror_to_prs_with_grasp_06
Tests still green (no regression):
- prs_namespace_404_when_grasp06_not_advertised_no_grasp_06
- nip11_advertises_grasp_06_when_enabled
- pr_event_rejected_when_clone_tag_does_not_name_prs_endpoint_with_grasp_06
Tests still red (deferred):
- prs_push_refs_nostr_event_id_accepted_with_grasp_06
- pr_event_accepted_when_clone_tag_names_prs_endpoint_with_grasp_06
- prs_push_mirrors_to_announced_repo_with_grasp_06
`tempfile` is promoted from a dev-dependency to a runtime dependency
because the empty-repo synthesis path needs it. No new config options,
so the four-place config-sync contract is unaffected.
11 lines
177 B
Rust
11 lines
177 B
Rust
pub mod audit_cleanup;
|
|
pub mod cleanup_empty_repos;
|
|
pub mod config;
|
|
pub mod git;
|
|
pub mod grasp06;
|
|
pub mod http;
|
|
pub mod metrics;
|
|
pub mod nostr;
|
|
pub mod purgatory;
|
|
pub mod sync;
|