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.

Add repository settings for description, branch, and visibility

1948358f9719cd0e5a15bd75a5d5dd3640e4ea82 · Keenan Nemetz · 15d ago · parent e84a66f5

Add repository settings for description, branch, and visibility

The Settings tab is shown only to repository admins and edits the facts that
repository owns: description, default branch (validated and required to exist),
and public/private visibility. Visibility toggles the ACL default between none
and read and leaves explicit entries alone; access rules stay an instance-admin
operation.

The page is read-gated before it is admin-gated, so a private repository still
answers 404 rather than confirming that settings exist. Saves carry CSRF, are
audited, and refresh the repository index. Adds Meta setters for the description
file and HEAD, plus git helpers to validate a branch and point HEAD at it.

core/git/git.go +21

@@ -401,6 +401,27 @@ func (r *Repo) Symref() string {
401 401 return strings.TrimSpace(string(out))
402 402 }
403 403
404 // SetHEAD points HEAD at an existing branch. It does not create the branch; the
405 // caller decides whether an unborn HEAD is acceptable.
406 func (r *Repo) SetHEAD(branch string) error {
407 _, errs, err := r.run(nil, "symbolic-ref", "HEAD", "refs/heads/"+branch)
408 if err != nil {
409 return fmt.Errorf("set HEAD to %s: %w: %s", branch, err, errs)
410 }
411 return nil
412 }
413
414 // ValidBranch reports whether name is a syntactically valid branch. It checks
415 // the full ref rather than using --branch, which would expand @{-1} and similar
416 // history syntax instead of validating the bytes the caller wrote.
417 func (r *Repo) ValidBranch(name string) bool {
418 if name == "" || strings.HasPrefix(name, "-") || strings.Contains(name, "\x00") {
419 return false
420 }
421 _, _, err := r.run(nil, "check-ref-format", "refs/heads/"+name)
422 return err == nil
423 }
424
404 425 // commitFormat is one line per commit: sha, author, email, epoch, subject.
405 426 // %x1f is a unit separator, which cannot appear in a subject the way a tab or a
406 427 // newline can.