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 code search

aef992843b95fd107327b103c12d135cd708c11e · Keenan Nemetz · 15d ago · parent 5cab7b18

Add repository code search

The Code tab now searches file names and plain-text contents at the selected branch. Contents go through git grep with fixed strings, case-insensitive matching, binary skipping, and a capped result set; there is no second index to drift. Results group by file and link to line anchors in the blob view. Also highlights a targeted line and adds the remaining polish notes to the UI plan.

core/git/grep_test.go +37

@@ -0,0 +1,37 @@
1 package git
2
3 import (
4 "os/exec"
5 "path/filepath"
6 "strings"
7 "testing"
8 )
9
10 func TestGrepFindsFixedStrings(t *testing.T) {
11 dir := filepath.Join(t.TempDir(), "r.git")
12 if out, err := exec.Command("git", "init", "--bare", "-q", dir).CombinedOutput(); err != nil {
13 t.Fatalf("init: %v: %s", err, out)
14 }
15 g := Open(dir)
16 if _, err := CommitFiles(g, "refs/heads/main", func(files map[string][]byte) error {
17 files["main.go"] = []byte("package main\n// HelloNeedle lives here\n")
18 files["README.md"] = []byte("nothing\n")
19 return nil
20 }, "init", "test"); err != nil {
21 t.Fatal(err)
22 }
23 sha, err := g.RevParse("refs/heads/main")
24 if err != nil {
25 t.Fatal(err)
26 }
27 out, cut, err := g.Grep(sha, "needle", 4096)
28 if err != nil {
29 t.Fatal(err)
30 }
31 if cut {
32 t.Fatal("small result was truncated")
33 }
34 if !strings.Contains(string(out), "main.go:2:") || !strings.Contains(string(out), "HelloNeedle") {
35 t.Fatalf("grep output = %q", out)
36 }
37 }