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.

Simplify release file management

fdd0b3e8373da4c684c73d88f997c3917966ac50 · Keenan Nemetz · 17d ago · parent c5187449

Simplify release file management

Drop rename and move from the CLI and browser, outline the files table instead of wrapping it in a card, and label the release-page action Manage files.

metadata/releases_test.go −58

@@ -171,64 +171,6 @@ func TestWriteReleasePointersValidates(t *testing.T) {
171 171 }
172 172 }
173 173
174 func TestMoveReleasePointer(t *testing.T) {
175 t.Parallel()
176 g := writeRepo(t)
177 putReleasePointer(t, g, "releases/v1/tool", 10)
178 putReleasePointer(t, g, "releases/v1/apt/Packages", 20)
179
180 if err := MoveReleasePointer(g, Ref, "v1", "tool", "bin/tool", "move", "keenan"); err != nil {
181 t.Fatal(err)
182 }
183 list, err := ListReleaseArtifacts(g, "v1")
184 if err != nil {
185 t.Fatal(err)
186 }
187 if len(list) != 2 || list[0].Name != "apt/Packages" || list[1].Name != "bin/tool" {
188 t.Fatalf("artifacts after move = %+v", list)
189 }
190 if list[1].OID != testOID || list[1].Size != 10 {
191 t.Fatalf("the pointer changed during the move: %+v", list[1])
192 }
193 if _, err := ListReleaseArtifacts(g, "missing"); err != nil {
194 t.Fatal(err)
195 }
196 }
197
198 func TestMoveReleasePointerRefuses(t *testing.T) {
199 t.Parallel()
200 g := writeRepo(t)
201 putReleasePointer(t, g, "releases/v1/tool", 10)
202 putReleasePointer(t, g, "releases/v1/other", 20)
203 putReleasePointer(t, g, "releases/v1/apt/Packages", 30)
204
205 for _, tc := range []struct {
206 name string
207 from, to string
208 want string
209 }{
210 {"missing source", "absent", "bin/absent", "not an attached file"},
211 {"existing target", "tool", "other", "already attached"},
212 {"target is a directory", "tool", "apt", "directory on this release"},
213 {"target under a file", "tool", "other/bin", "is a file on this release"},
214 {"same path", "tool", "tool", "already the path"},
215 {"invalid target", "tool", "../escape", "must not contain"},
216 } {
217 if err := MoveReleasePointer(g, Ref, "v1", tc.from, tc.to, "move", "keenan"); err == nil || !strings.Contains(err.Error(), tc.want) {
218 t.Errorf("%s: MoveReleasePointer = %v, want it to mention %q", tc.name, err, tc.want)
219 }
220 }
221
222 // A refusal changes nothing.
223 list, err := ListReleaseArtifacts(g, "v1")
224 if err != nil {
225 t.Fatal(err)
226 }
227 if len(list) != 3 {
228 t.Fatalf("a refused move changed the tree: %+v", list)
229 }
230 }
231
232 174 func TestRemoveReleasePointers(t *testing.T) {
233 175 t.Parallel()
234 176 g := writeRepo(t)