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.

Read the metadata tree in one git call

5cecc6183eadab8147d11438abc64d54c4b0a78f · Keenan Nemetz · 10d ago · parent 5fce878d

Read the metadata tree in one git call

The issue and change-request loaders read the metadata tree with one
`git cat-file` per file, so a page render cost as many processes as the
branch had issues and comments. On a repository with 30 change requests
the overview paid 114 git invocations and 98 ms; the requests list paid
72 and 90 ms.

Read every listed blob through a single `cat-file --batch`. The push
validators share the same helper, so pre-receive stops paying one
process per file as well.

The metadata branch is the whole source of truth for issues and changes,
so this is the read path that grows with use. Nothing about the format or
the size limits changes: an oversized file is still refused before any of
it is allocated.

metadata/limits.go +15−3

@@ -51,11 +51,23 @@ func readMetadata(g *git.Repo, commit, prefix string) (map[string]string, error)
51 51 if problems := metadataSizeProblems(paths, shas, g); len(problems) > 0 {
52 52 return nil, errors.New(problems[0])
53 53 }
54 return readBlobs(g, paths, shas)
55 }
56
57 // readBlobs reads the named files in one git call. It is one process whether the
58 // prefix holds one file or ten thousand: a page that lists a repository's change
59 // requests must not cost a process per request, and a push validator must not
60 // cost one per file either.
61 func readBlobs(g *git.Repo, paths, shas []string) (map[string]string, error) {
62 blobs, err := g.BlobsBySHA(shas)
63 if err != nil {
64 return nil, fmt.Errorf("cannot read the metadata files: %w", err)
65 }
54 66 contents := make(map[string]string, len(paths))
55 67 for i, path := range paths {
56 data, err := g.BlobBySHA(shas[i])
57 if err != nil {
58 return nil, err
68 data, ok := blobs[shas[i]]
69 if !ok {
70 return nil, fmt.Errorf("metadata: %s was listed but not read", path)
59 71 }
60 72 contents[path] = string(data)
61 73 }