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.

Number issues and change requests for human references

e05f1c48d4ee55635cd7b77889f0545137198106 · Keenan Nemetz · 13d ago · parent 41d1fee9

Number issues and change requests for human references

A ULID is an unreadable handle, and the 8-character prefix the list showed
is mostly timestamp: this repository's 27 issues shared seven distinct
six-character prefixes and two pairs already collided at eight. The part
people actually type carried almost no information.

Issues and change requests now share one gap-free sequence (#1, #42, ...)
derived from the creation order in the metadata branch's history, the way
one forge counts both in a single run.

The number is not stored. It is the rank of the entity's creation commit,
so nothing is written when an entity is created, a repository needs no
backfill, the same history gives the same numbers on every clone, and
`vole admin index rebuild` reproduces them from git. A ULID stays the
identity: paths, front matter, `closes:` and audit entries are unchanged,
and data/index.db only caches the mapping so a page render does not walk
history.

Every id-taking command accepts a number, `#42` links in a body through a
kind-agnostic /r/<repo>/n/42 route, and --closes resolves an alias to the
ULID before writing.

Closes #45

server/web/requests.go +7−2

@@ -83,6 +83,8 @@ func headBranches(all []string, acl *access.ACL, account string) []string {
83 83 type requestRow struct {
84 84 *metadata.Request
85 85 Current int
86 // Number is the `#42` alias from the numbers map the page was built with.
87 Number int
86 88 }
87 89
88 90 // Requests lists a repo's change requests. They are read straight from git: the
@@ -107,6 +109,7 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
107 109 }
108 110 query := strings.TrimSpace(r.URL.Query().Get("q"))
109 111 needle := strings.ToLower(query)
112 nums := w.entityNumbers(m)
110 113 rows := make([]requestRow, 0, len(list))
111 114 open := 0
112 115 for _, req := range list {
@@ -128,7 +131,7 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
128 131 current++
129 132 }
130 133 }
131 rows = append(rows, requestRow{Request: req, Current: current})
134 rows = append(rows, requestRow{Request: req, Current: current, Number: nums[req.ID]})
132 135 }
133 136 sort.SliceStable(rows, func(i, j int) bool {
134 137 if (rows[i].State == "open") != (rows[j].State == "open") {
@@ -153,6 +156,7 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
153 156 Page
154 157 Name string
155 158 Rows []requestRow
159 Numbers map[string]int
156 160 State string
157 161 Query string
158 162 Open int
@@ -167,7 +171,8 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
167 171 Pager pager
168 172 }{
169 173 Page: w.page(r, m.Name+" · change requests"), Name: m.Name, Rows: rows, State: state,
170 Query: query, Open: open, Total: len(list), Closed: len(list) - open,
174 Numbers: nums,
175 Query: query, Open: open, Total: len(list), Closed: len(list) - open,
171 176 Required: required, Filtered: query != "" || (state != "open" && len(list) > 0),
172 177 CanOpen: form.CanOpen, Base: form.Base,
173 178 BaseBranches: form.BaseBranches, HeadBranches: form.HeadBranches,