Sign in

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

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Require a linked issue when a change request opens

0789f22ea633bf995417893c0052abb6a36d5520 · Keenan Nemetz · 9d ago · parent 1265ea55

Require a linked issue when a change request opens

Add a per-repository policy for teams that want every proposed update to trace back to an issue. The browser marks Closes as required, and the pre-receive hook applies the same rule to requests added through the CLI or a hand-written metadata commit. Existing requests stay editable and landable.

server/hook/hook.go +18

@@ -368,6 +368,24 @@ func PreReceive(cfg Config) int {
368 368 for _, prob := range metadata.ValidateRequests(g, c.new) {
369 369 problems = append(problems, "requests: "+prob)
370 370 }
371 // The repository may require a linked issue when a request is opened.
372 // Check only the requests this push adds: existing requests keep their
373 // history when the policy is turned on, and an edit to one is not a new
374 // opening. The browser writes metadata directly, so it makes the same
375 // check in CreateChangeRequest.
376 if a.RequiresLinkedIssue() {
377 added, err := metadata.NewRequests(g, c.old, c.new)
378 if err != nil {
379 problems = append(problems, "requests: cannot check the linked-issue rule: "+err.Error())
380 } else {
381 for _, req := range added {
382 if len(req.Closes) == 0 {
383 problems = append(problems, fmt.Sprintf(
384 "requests: %s: opening a change request here requires at least one linked issue (use --closes <issue>)", req.ID))
385 }
386 }
387 }
388 }
371 389 // An approval is a statement about the actor's own review, so the file
372 390 // name must be the actor's account name. Without this, anyone with write
373 391 // access could commit approvals/<someone-else>.json and approve on their