Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Let a release change until a channel names it

214e7ea67ccb37d356a52097f8ce838bdf4c1731 · Keenan Nemetz · 17d ago · parent 502119f4

Let a release change until a channel names it

A release is mutable again. Notes can be edited and files added, replaced,
or removed after publication, because a mistyped note or a rebuilt binary
is not a reason to cut a new version. Editing the notes re-tags the same
commit, which the old rule refused from the first attached file.

The one thing that stays frozen is a release a channel names. A channel
records the tag name and the tag object, so a re-tag would dangle it and a
changed pointer would serve different bytes under a URL a package manager
already cached. Pre-receive reads the channel table from the instance
database and refuses every change to a channeled release — tag moves and
deletes, and added, replaced, or removed pointers alike — naming the
channel and how to move it. The browser applies the same rule: the edit
form, the attach form, and the list link are all drawn from it.

Attaching also works from the browser now, at parity with the CLI. The
Artifacts card takes files, or a directory, and an optional directory to
publish under; the handler streams each part to a temp file while hashing
it, checks the object-store quota before storing anything, writes bytes
first and pointers second, and calls the same metadata writer the CLI
does. A directory upload keeps its paths, which is why the body is read as
a multipart stream rather than through ParseForm.

server/web/releases.go +33−2

@@ -53,6 +53,8 @@ type releasesView struct {
53 53 Lightweight int
54 54 Channels []channelRow
55 55 ChannelsByTag map[string][]string
56 Editable map[string]bool
57 AnyEditable bool
56 58 CanManage bool
57 59 ManageChannels bool
58 60 }
@@ -73,7 +75,12 @@ func (w *Web) releasesView(r *http.Request, m *repo.Meta, tags []git.Tag) releas
73 75 list := w.channels(m)
74 76 rows := make([]channelRow, 0, len(list))
75 77 byTag := make(map[string][]string, len(list))
78 // named is every channel target, dangling included: a channel whose object no
79 // longer matches still names the release, and the push gate still refuses to
80 // change it, so the list must not offer the link.
81 named := make(map[string]bool, len(list))
76 82 for _, ch := range list {
83 named[ch.Release] = true
77 84 t, ok := byName[ch.Release]
78 85 ok = ok && channelTargetFromTag(t, ch)
79 86 rows = append(rows, channelRow{
@@ -88,6 +95,18 @@ func (w *Web) releasesView(r *http.Request, m *repo.Meta, tags []git.Tag) releas
88 95 }
89 96
90 97 canManage := w.canManageReleases(r, m)
98 // A release a channel names cannot be edited, so the list does not offer the
99 // link. Every tag is decided from the channel rows already in hand: the rule
100 // that hides the link is the rule the handler enforces. AnyEditable doubles as
101 // "this viewer gets that column at all", so a reader sees the same table as
102 // before the column existed.
103 editable := make(map[string]bool, len(tags))
104 anyEditable := false
105 for _, t := range tags {
106 ok := canManage && t.Annotated && !named[t.Name]
107 editable[t.Name] = ok
108 anyEditable = anyEditable || ok
109 }
91 110 return releasesView{
92 111 Page: w.page(r, m.Name+" · releases"),
93 112 Name: m.Name,
@@ -95,6 +114,8 @@ func (w *Web) releasesView(r *http.Request, m *repo.Meta, tags []git.Tag) releas
95 114 Lightweight: light,
96 115 Channels: rows,
97 116 ChannelsByTag: byTag,
117 Editable: editable,
118 AnyEditable: anyEditable,
98 119 CanManage: canManage,
99 120 ManageChannels: canManage && w.ChannelStore != nil,
100 121 }
@@ -160,6 +181,10 @@ func (w *Web) ReleaseView(rw http.ResponseWriter, r *http.Request) {
160 181 notes = w.renderMarkdown(m.Name, t.Message)
161 182 }
162 183
184 channelNames := w.channelsForTag(m, t.Name)
185 refusal := w.releaseRefusal(m, t)
186 canManage := w.canManageReleases(r, m)
187
163 188 w.render(rw, "release", struct {
164 189 Page
165 190 Name string
@@ -175,6 +200,9 @@ func (w *Web) ReleaseView(rw http.ResponseWriter, r *http.Request) {
175 200 ArtifactBytes int64
176 201 Channels []string
177 202 CanEdit bool
203 CanAttach bool
204 ChannelLocked bool
205 UploadCap int64
178 206 }{
179 207 Page: w.page(r, m.Name+" · "+t.Name),
180 208 Name: m.Name,
@@ -188,8 +216,11 @@ func (w *Web) ReleaseView(rw http.ResponseWriter, r *http.Request) {
188 216 LFSPointers: lfsPointers,
189 217 Artifacts: artifacts,
190 218 ArtifactBytes: artifactBytes,
191 Channels: w.channelsForTag(m, t.Name),
192 CanEdit: w.canManageReleases(r, m) && t.Annotated && len(artifacts) == 0,
219 Channels: channelNames,
220 CanEdit: canManage && refusal == "",
221 CanAttach: canManage && refusal == "",
222 ChannelLocked: t.Annotated && len(channelNames) > 0,
223 UploadCap: w.attachLimit(),
193 224 }, 0)
194 225 }
195 226