diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-05-21 15:29:22 +0100 |
|---|---|---|
| committer | fiatjaf_ <fiatjaf@gmail.com> | 2024-08-01 13:34:19 -0300 |
| commit | 788ffb03a001eb1e26444472ee9211ff51d16baa (patch) | |
| tree | aba345298278125f806fccded8dbafc1f182f1f0 | |
| parent | 8022a96ece6afccad5be180fd45b7ffbf07b3deb (diff) | |
nip34: add refs to repo event
so that the event can be used as a source of truth for the state of refs
such as branches and tags
this could be useful as:
1. a way to reduce trust in git server(s) so they no longer act as a
source of truth. a nip34 git remote-helper could proxy requests to
git servers and only pull updates when they match the state listed in
the repo event.
2. a form of authorisation for nip34 git server implementations
such as song
3. a way of enabling experimentation with other protocols for hosting
and accessing git data. eg a blossom git remote helper
| -rw-r--r-- | 34.md | 30 |
1 files changed, 30 insertions, 0 deletions
| @@ -35,6 +35,36 @@ The `r` tag annotated with the `"euc"` marker should be the commit ID of the ear | |||
| 35 | 35 | ||
| 36 | Except `d`, all tags are optional. | 36 | Except `d`, all tags are optional. |
| 37 | 37 | ||
| 38 | ## Repository state announcements | ||
| 39 | |||
| 40 | An optional source of truth for the state of branches and tags in a repository. | ||
| 41 | |||
| 42 | ```jsonc | ||
| 43 | { | ||
| 44 | "kind": 30618, | ||
| 45 | "content": "", | ||
| 46 | "tags": [ | ||
| 47 | ["d", "<repo-id>"], // matches the identifier in the coresponding repository announcement | ||
| 48 | ["refs/<heads|tags>/<branch-or-tag-name>","<commit-id>"] | ||
| 49 | ["HEAD", "ref: refs/heads/<branch-name>"] | ||
| 50 | ] | ||
| 51 | } | ||
| 52 | ``` | ||
| 53 | |||
| 54 | The `refs` tag may appear multiple times, or none. | ||
| 55 | |||
| 56 | If no `refs` tags are present, the author is no longer tracking repository state using this event. This approach enables the author to restart tracking state at a later time unlike [NIP-09](09.md) deletion. | ||
| 57 | |||
| 58 | The `refs` tag can be optionally extended to enable clients to identify how many commits ahead a ref is: | ||
| 59 | |||
| 60 | ```jsonc | ||
| 61 | { | ||
| 62 | "tags": [ | ||
| 63 | ["refs/<heads|tags>/<branch-or-tag-name>", "<commit-id>", "<shorthand-parent-commit-id>", "<shorthand-grandparent>", ...], | ||
| 64 | ] | ||
| 65 | } | ||
| 66 | ``` | ||
| 67 | |||
| 38 | ## Patches | 68 | ## Patches |
| 39 | 69 | ||
| 40 | Patches can be sent by anyone to any repository. Patches to a specific repository SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. Patch events SHOULD include an `a` tag pointing to that repository's announcement address. | 70 | Patches can be sent by anyone to any repository. Patches to a specific repository SHOULD be sent to the relays specified in that repository's announcement event's `"relays"` tag. Patch events SHOULD include an `a` tag pointing to that repository's announcement address. |