upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/reference
diff options
context:
space:
mode:
Diffstat (limited to 'docs/reference')
-rw-r--r--docs/reference/git-protocol.md38
1 files changed, 38 insertions, 0 deletions
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
5This document explains the Git Smart HTTP protocol as it relates to our inline authorization implementation. 5This 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
11Per 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
17These 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
23Git 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
26git -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
32Clients 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
37GIT_TRACE_PACKET=1 git ls-remote https://ngit.danconwaydev.com/npub.../repo.git 2>&1 | grep -E "allow-|filter"
38```
39
40Expected output should include:
41```
42pkt-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)