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.
Highlight syntax in diff views
e7982ac5137be6e891616cdcdedc035f9019f99b · Keenan Nemetz · 12d ago · parent a76b2f38
Highlight syntax in diff views The diff parser now names each file's Prism language from the new path (or the old path for a deletion), and the shared diff template carries that language plus the side of every line. app.js queues a diff once per side, so an old-side string or comment cannot colour new-side lines, and the token palette now covers diff cells as well as blobs. The commit, compare, and change-request Files views all use the same template, so they gain highlighting together.
server/web/diff_test.go +37
| @@ -40,6 +40,9 @@ func TestParseDiff(t *testing.T) { | |||
| 40 | 40 | if first.Added != 2 || first.Removed != 1 { | |
| 41 | 41 | t.Fatalf("counts = +%d −%d, want +2 −1", first.Added, first.Removed) | |
| 42 | 42 | } | |
| 43 | if first.Language != "markdown" { | ||
| 44 | t.Fatalf("readme language = %q, want markdown", first.Language) | ||
| 45 | } | ||
| 43 | 46 | if len(first.Hunks) != 1 || len(first.Hunks[0].Lines) != 5 { | |
| 44 | 47 | t.Fatalf("hunk shape = %+v", first.Hunks) | |
| 45 | 48 | } | |
| @@ -60,6 +63,40 @@ func TestParseDiff(t *testing.T) { | |||
| 60 | 63 | if second.Removed != 2 { | |
| 61 | 64 | t.Fatalf("deletion counts = −%d", second.Removed) | |
| 62 | 65 | } | |
| 66 | if second.Language != "" { | ||
| 67 | t.Fatalf("plain-text deletion language = %q, want none", second.Language) | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | // A deletion has no new path, so its language comes from the old one. A rename | ||
| 72 | // uses the new name, which is the file a reviewer sees in the review tree. | ||
| 73 | func TestDiffLanguageUsesTheVisiblePath(t *testing.T) { | ||
| 74 | t.Parallel() | ||
| 75 | files := parseDiff(`diff --git a/gone.go b/gone.go | ||
| 76 | deleted file mode 100644 | ||
| 77 | --- a/gone.go | ||
| 78 | +++ /dev/null | ||
| 79 | @@ -1 +0,0 @@ | ||
| 80 | -package gone | ||
| 81 | diff --git a/old.py b/new.py | ||
| 82 | similarity index 90% | ||
| 83 | rename from old.py | ||
| 84 | rename to new.py | ||
| 85 | --- a/old.py | ||
| 86 | +++ b/new.py | ||
| 87 | @@ -1 +1 @@ | ||
| 88 | -old | ||
| 89 | +new | ||
| 90 | `) | ||
| 91 | if len(files) != 2 { | ||
| 92 | t.Fatalf("parsed %d files, want 2: %+v", len(files), files) | ||
| 93 | } | ||
| 94 | if files[0].Language != "go" { | ||
| 95 | t.Fatalf("deletion language = %q, want go", files[0].Language) | ||
| 96 | } | ||
| 97 | if files[1].Language != "python" { | ||
| 98 | t.Fatalf("rename language = %q, want python", files[1].Language) | ||
| 99 | } | ||
| 63 | 100 | } | |
| 64 | 101 | ||
| 65 | 102 | func TestParseDiffOfABinaryFile(t *testing.T) { | |