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/vole.git

Write over SSH with a registered key:

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

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

Add vole change merge, over an SSH verb

b14a78191909907be833d27d82d215a0319de9e3 · Keenan Nemetz · 13d ago · parent 38b30251

Add vole change merge, over an SSH verb

The landing operation existed but only the browser could reach it. The CLI
cannot do it from a clone: whether a landing is allowed depends on the
repository's ACL, the approvals filed against the request, and the run
results, and none of those are in the working tree.

So the CLI asks the instance, over the key it already pushes with. The new
verb takes a repository path and a request id and answers one line; the
server resolves the rules, runs forge/landing.Land, and writes the merge
line to the audit log the same way a push does.

Merging is the approve capability, and the author is not excluded: landing
your own request once somebody else approved it is the point of separating
the two. Whether an approval exists is the gate's question, asked inside
Land, so the CLI, the browser button and the pre-receive hook cannot
disagree about it.

The verb accepts the same remote path shape as the git verbs and runs it
through the same repository-name check, so a name that would be refused on
a push is refused here too.

Closes #01M5XF4XWHVMMCQEYENA8X32GK.

client/remote.go +25

@@ -193,3 +193,28 @@ func (a *Actor) Page(kind, id, anchor string) string {
193 193 }
194 194 return u
195 195 }
196
197 // MergeChange asks the instance to land a change request, and returns the server's
198 // one-line answer.
199 //
200 // Landing moves a branch, so it cannot be done from a clone: the rules that decide
201 // it — the repository's ACL, the approvals filed against the request, and the run
202 // results — live in the instance. The CLI asks over the key it already pushes with,
203 // and the server runs the same operation the browser's merge button runs.
204 func MergeChange(gitDir, remote, id string) (string, error) {
205 host, port, path, err := SSHTarget(gitDir, remote)
206 if err != nil {
207 return "", err
208 }
209 if RepoNameFromPath(path) == "" {
210 return "", fmt.Errorf("%s does not name a repository", remote)
211 }
212 // The path goes as the remote names it ("/demo.git"), which is the shape the
213 // server's own repository-path check accepts for the git verbs. One check, one
214 // shape, so a name that would be refused on a push is refused here too.
215 out, err := RunSSH(host, port, "vole-change-merge "+path+" "+id)
216 if err != nil {
217 return "", err
218 }
219 return strings.TrimSpace(out), nil
220 }