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.
|
64ac5071
Keenan Nemetz
17d ago
|
1 | package lfs |
| 2 | ||
| 3 | import "testing" | |
| 4 | ||
| 5 | // TestParsePointerFromARealClient pins the exact bytes git-lfs writes. An earlier | |
| 6 | // version of this parser accepted a first line without the `version ` key and the | |
| 7 | // hook silently stopped recognising pointers — the whole gate went quiet, and only | |
| 8 | // the end-to-end test noticed. | |
| 9 | func TestParsePointerFromARealClient(t *testing.T) { | |
|
44530e74
Keenan Nemetz
16d ago
|
10 | t.Parallel() |
|
64ac5071
Keenan Nemetz
17d ago
|
11 | text := "version https://git-lfs.github.com/spec/v1\n" + |
| 12 | "oid sha256:6c82914b2d961ffcbbe375c41515e962207893b7207bfd293d37e5cf58bb752b\n" + | |
| 13 | "size 30\n" | |
| 14 | if len(text) != 127 { | |
| 15 | t.Fatalf("fixture is %d bytes; the client writes a 127-byte pointer for these fields", len(text)) | |
| 16 | } | |
| 17 | p, ok := ParsePointer([]byte(text)) | |
| 18 | if !ok { | |
| 19 | t.Fatalf("did not parse the bytes a client actually writes:\n%s", text) | |
| 20 | } | |
| 21 | if p.OID != "6c82914b2d961ffcbbe375c41515e962207893b7207bfd293d37e5cf58bb752b" || p.Size != 30 { | |
| 22 | t.Fatalf("parsed %+v", p) | |
| 23 | } | |
| 24 | // A url with no `version` key is a filter line, not a pointer. | |
| 25 | bare := "https://git-lfs.github.com/spec/v1\n" + | |
| 26 | "oid sha256:6c82914b2d961ffcbbe375c41515e962207893b7207bfd293d37e5cf58bb752b\n" + | |
| 27 | "size 30\n" | |
| 28 | if _, ok := ParsePointer([]byte(bare)); ok { | |
| 29 | t.Fatal("a bare url on the first line was accepted as a pointer") | |
| 30 | } | |
| 31 | } |