diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 14:05:51 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 14:05:51 +0000 |
| commit | 817ce37a5ee8d6279a44cf8cce3cc6a1e4bab576 (patch) | |
| tree | 9fd5a6d3969afc33baa900bdab25bff81c5a83a4 /docs | |
| parent | f25eea8cc3b940cbcaa96224485826bfaae82449 (diff) | |
feat: add uploadpack.allowFilter support for GRASP-01 compliance
Add mandatory uploadpack.allowFilter capability to support partial clones
and fetches as required by GRASP-01 specification. This enables efficient
git operations for bandwidth-constrained clients (e.g., browser-based git
clients like git-natural-api).
Changes:
- Add uploadpack.allowFilter=true to git subprocess configuration
- Update SmartGitServer test helper with filter support
- Add integration tests for filter capability advertisement and functionality
- Update documentation to reflect filter as required capability
Tests verify:
- Filter capability is advertised in info/refs
- Filtered clones with blob:none work correctly
- Filtered fetches with tree:0 work correctly
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/learnings/grasp-01-implementation.md | 3 | ||||
| -rw-r--r-- | docs/reference/git-protocol.md | 38 |
2 files changed, 40 insertions, 1 deletions
diff --git a/docs/learnings/grasp-01-implementation.md b/docs/learnings/grasp-01-implementation.md index 14ab452..27124af 100644 --- a/docs/learnings/grasp-01-implementation.md +++ b/docs/learnings/grasp-01-implementation.md | |||
| @@ -42,7 +42,8 @@ | |||
| 42 | - ✅ Recursive maintainer chain support | 42 | - ✅ Recursive maintainer chain support |
| 43 | - ✅ HEAD set from state events | 43 | - ✅ HEAD set from state events |
| 44 | - ✅ `refs/nostr/<event-id>` support for PRs | 44 | - ✅ `refs/nostr/<event-id>` support for PRs |
| 45 | - ✅ `allow-tip-sha1-in-want` and `allow-reachable-sha1-in-want` | 45 | - ✅ `allow-tip-sha1-in-want` and `allow-reachable-sha1-in-want` (GRASP-01 requirement) |
| 46 | - ✅ `uploadpack.allowFilter` for partial clone support (required by git-natural-api) | ||
| 46 | 47 | ||
| 47 | --- | 48 | --- |
| 48 | 49 | ||
diff --git a/docs/reference/git-protocol.md b/docs/reference/git-protocol.md index 172a7bc..c0ecb3b 100644 --- a/docs/reference/git-protocol.md +++ b/docs/reference/git-protocol.md | |||
| @@ -4,6 +4,44 @@ | |||
| 4 | 4 | ||
| 5 | This document explains the Git Smart HTTP protocol as it relates to our inline authorization implementation. | 5 | This document explains the Git Smart HTTP protocol as it relates to our inline authorization implementation. |
| 6 | 6 | ||
| 7 | ## Required Git Capabilities | ||
| 8 | |||
| 9 | ### GRASP-01 Requirements (MUST) | ||
| 10 | |||
| 11 | Per the [GRASP-01 specification](https://github.com/DanConwayDev/grasp/blob/main/01.md), implementations **MUST** advertise and support the following git capabilities: | ||
| 12 | |||
| 13 | - **`allow-reachable-sha1-in-want`**: Allows clients to request commits reachable from any ref | ||
| 14 | - **`allow-tip-sha1-in-want`**: Allows clients to request specific commit SHAs directly | ||
| 15 | - **`uploadpack.allowFilter`**: Enables partial clone/fetch with `--filter` options | ||
| 16 | |||
| 17 | These are essential for supporting `refs/nostr/<event-id>` (PR refs) and bandwidth-efficient partial clones. | ||
| 18 | |||
| 19 | **Implementation:** `src/git/subprocess.rs:36-42` | ||
| 20 | |||
| 21 | ### How Capabilities are Advertised | ||
| 22 | |||
| 23 | Git capabilities are advertised during the initial `GET /info/refs?service=git-upload-pack` request. The server spawns `git upload-pack --advertise-refs` with configuration flags: | ||
| 24 | |||
| 25 | ```bash | ||
| 26 | git -c uploadpack.allowReachableSHA1InWant=true \ | ||
| 27 | -c uploadpack.allowTipSHA1InWant=true \ | ||
| 28 | -c uploadpack.allowFilter=true \ | ||
| 29 | upload-pack --advertise-refs --stateless-rpc /path/to/repo.git | ||
| 30 | ``` | ||
| 31 | |||
| 32 | Clients parse the capability list from the response and only use features the server advertises. | ||
| 33 | |||
| 34 | **Verification:** Test with `git ls-remote`: | ||
| 35 | |||
| 36 | ```bash | ||
| 37 | GIT_TRACE_PACKET=1 git ls-remote https://ngit.danconwaydev.com/npub.../repo.git 2>&1 | grep -E "allow-|filter" | ||
| 38 | ``` | ||
| 39 | |||
| 40 | Expected output should include: | ||
| 41 | ``` | ||
| 42 | pkt-line: ... allow-tip-sha1-in-want allow-reachable-sha1-in-want filter ... | ||
| 43 | ``` | ||
| 44 | |||
| 7 | ## Protocol Flow | 45 | ## Protocol Flow |
| 8 | 46 | ||
| 9 | ### Clone/Fetch (Upload Pack) | 47 | ### Clone/Fetch (Upload Pack) |