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.
Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys
keenan · 21m ago
4b8c9e1d
| 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 | } |
| 38 |