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.

Phase 3: a change request can be discussed

7c6e52e75f3a33be57a81663bc840edd6e14f7f9 · Keenan Nemetz · 17d ago · parent 3c5d11fa

Phase 3: a change request can be discussed

Until now the only ways to say something about a request were editing its body or
approving it. A review thread is now a pushed file like everything else:

	requests/<ulid>/comments/<ulid>.md    author + created, then the body

It is the *same file shape* as a comment on an issue and is read and written by the
same code (`issues.ParseComment`, `issues.RenderComment`, with `requests.Comment` as
an alias), so the thread inherited the validation, the markdown boundary and the
ownership rule instead of reimplementing them. That last one is the part worth
having: `pre-receive` compares the author on the old blob to the pushing account, so
a review comment is its author's to edit or delete, an admin may repair a thread
(audited), and rewriting the author line in the same push does not launder it.

`vole request comment <id> -m` prints the comment's id and the page anchor
(`#c-<ulid>`), `edit-comment` and `rm-comment` are the author's own words, and
`request show` prints the thread so the ids are discoverable at all — an id nobody
can see is an id nobody can use. Adding a comment is free, like adding one to an
issue: a new file's author is a claim, and the boundary has never pretended
otherwise.

The request's own file stays outside the ownership rule, for the reason an issue's
does: state, head and base are shared, and updating them is the author's normal edit.

Verified: TestParseReadsTheDiscussion (a thread plus an approval in one tree,
ordered by id), TestCommentNeedsAnAuthorAndATime and
TestUnknownFileInARequestIsRefused (the subtree stays a closed format, with both
expected shapes named), TestCommentPaths (a request comment is not an issue comment
and not an approval); and end to end through the binary,
TestRequestDiscussionIsPushedAndOwned — the empty state prints the command, the CLI
adds a comment, the page renders it with its anchor and `request show` lists it, a
writer is refused rewriting, adopting and deleting somebody else's comment, may join
the thread and may edit his own — with the issue-comment empty state assertion added
to TestIssuePushedThenRendered earlier. scripts/ci.sh green (gofmt, vet, build,
markdown links, go test -race ./...).

internal/hook/hook.go +5−1

@@ -407,6 +407,8 @@ func approvalOwnership(g *gitx.Repo, c change, actor, actorID string, role acl.R
407 407 // - Issue files are not covered. They carry shared state — state, labels,
408 408 // assignees — so closing or labelling somebody else's issue is normal triage,
409 409 // and a description can be corrected by any writer, which it already could be.
410 // - A request's own file is not covered either, for the same reason: its state,
411 // head and base are shared, and updating them is the author's normal edit.
410 412 // - A first push has nothing to compare against, so it is skipped.
411 413 func commentOwnership(g *gitx.Repo, c change, actor, actorID string, role acl.Role, auditPath, usersDB string, out io.Writer) []string {
412 414 if c.old == "" || c.old == gitx.ZeroSHA {
@@ -437,7 +439,9 @@ func commentOwnership(g *gitx.Repo, c change, actor, actorID string, role acl.Ro
437 439 }()
438 440
439 441 for path, st := range status {
440 if !issues.IsCommentPath(path) {
442 // An issue comment and a review comment on a change request are the same
443 // file shape, so one rule covers both.
444 if !issues.IsCommentPath(path) && !requests.IsCommentPath(path) {
441 445 continue
442 446 }
443 447 // A rename has no blob at the destination, so its author cannot be