grow the fixture a polyglot wing
commit 2bf3fecf7c5a1d918d0001253443190083d4805e 路 parent 68bc19f54a
路 browse this tree
Ximianth, 2026-10-26 22:56:48 UTC
The hermetic fixture's second commit gains classifiable material for the coming language meter: Go (dominant), Rust (an extension that needs a content sniff), CSS (markup), plus a vendored file and a dotfile that classification must skip. Fixture shas repinned; page snapshots regenerated and reviewed hunk by hunk.
diff --git a/git_test.go b/git_test.go index f54e912..54eb16e 100644 --- a/git_test.go +++ b/git_test.go @@ -154,9 +154,11 @@ func TestLsTree(t *testing.T) { mode string size int64 }{ + {".gitignore", "blob", "100644", 7}, {"README.md", "blob", "100644", int64(len(fixtureReadme))}, {"docs", "tree", "040000", -1}, {"src", "tree", "040000", -1}, + {"vendor", "tree", "040000", -1}, } if len(entries) != len(want) { t.Fatalf("got %d entries (%v), want %d", len(entries), entries, len(want)) diff --git a/gitfixture_test.go b/gitfixture_test.go index 228720e..19792a8 100644 --- a/gitfixture_test.go +++ b/gitfixture_test.go @@ -26,9 +26,9 @@ var fixtureEnv = []string{ // The shas of the fixture repo built by buildFixtureRepo, byte-stable by construction. const ( - fixtureShaMain = "9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f" // tip of main (the second commit); also what v1.0 peels to + fixtureShaMain = "ced91a8519b59966124301e6383532f24223528b" // tip of main (the second commit); also what v1.0 peels to fixtureShaRoot = "64ac67a35d36079e167cb8f929fd57f859c8b5d1" // the first commit, parent of main - fixtureShaDev = "4512e6cc66983db33c062ce3f4baa344422fc1a6" // tip of the dev branch + fixtureShaDev = "9b492196b444f712640f1755e048d90d8c51de2e" // tip of the dev branch ) // fixtureReadme is the README content at the tip of main (dev's tip rewrites it). @@ -63,6 +63,9 @@ func writeFixtureFile(t *testing.T, dir, path, content string) { // on main's tip, and a dev branch one commit ahead of main (rewriting the README). // HEAD is left on main. A filename with a space is included deliberately: // path handling has to survive it. +// The src/ code files, vendor/, and .gitignore exist for language classification: +// Go dominant, Rust (an extension that needs a content sniff to classify), CSS (markup), +// and two paths the meter must skip (vendored, dotfile). func buildFixtureRepo(t *testing.T) string { t.Helper() dir := t.TempDir() @@ -75,6 +78,11 @@ func buildFixtureRepo(t *testing.T) string { writeFixtureFile(t, dir, "docs/notes.md", "Notes live here.\n") writeFixtureFile(t, dir, "docs/with space.txt", "even this filename works\n") writeFixtureFile(t, dir, "src/hello.txt", "hello from the fixture\n") + writeFixtureFile(t, dir, "src/hello.go", "package hello\n\nimport \"fmt\"\n\n// Greet says hello from the fixture, at some length:\n// the meter wants Go to dominate this repo's composition.\nfunc Greet(name string) string {\n\treturn fmt.Sprintf(\"hello, %s, from the fixture\", name)\n}\n") + writeFixtureFile(t, dir, "src/lib.rs", "pub fn greet(name: &str) -> String {\n format!(\"hello, {name}\")\n}\n") + writeFixtureFile(t, dir, "src/style.css", ".hello { color: rebeccapurple; }\n") + writeFixtureFile(t, dir, "vendor/mini.js", "export const mini = () => 'vendored';\n") + writeFixtureFile(t, dir, ".gitignore", "/dist/\n") gitFixture(t, dir, "add", "-A") gitFixture(t, dir, "commit", "-q", "-m", "add docs and src") gitFixture(t, dir, "tag", "-a", "v1.0", "-m", "the first showing") diff --git a/testdata/pages.md b/testdata/pages.md index 503ab49..fc9f989 100644 --- a/testdata/pages.md +++ b/testdata/pages.md @@ -93,7 +93,7 @@ Content-Type: text/html; charset=utf-8 <div class="exhibit"><h1 id="fixturama">Fixturama<a href="#fixturama" class="anchor">馃敆</a></h1> <p>A repo that exists to be looked at.</p> </div> -<p class="plaque">README.md 路 49 B 路 main = <code>9db23702e9</code></p> +<p class="plaque">README.md 路 49 B 路 main = <code>ced91a8519</code></p> <p class="clone boxed" id="clone">clone: <code>git clone http://socle.example/fixturama</code></p> <p id="branches">branches: <a href="/fixturama/tree/dev/">dev</a>, <a href="/fixturama/tree/main/">main</a> 路 tags: <a href="/fixturama/tree/v1.0/">v1.0</a></p> @@ -146,6 +146,8 @@ Content-Type: text/html; charset=utf-8 <tbody> <tr><td class="name"><a href="/fixturama/tree/main/docs/">docs/</a></td><td class="size"></td></tr> <tr><td class="name"><a href="/fixturama/tree/main/src/">src/</a></td><td class="size"></td></tr> +<tr><td class="name"><a href="/fixturama/tree/main/vendor/">vendor/</a></td><td class="size"></td></tr> +<tr><td class="name"><a href="/fixturama/tree/main/.gitignore">.gitignore</a></td><td class="size">7 B</td></tr> <tr><td class="name"><a href="/fixturama/tree/main/README.md">README.md</a></td><td class="size">49 B</td></tr> </tbody> </table> @@ -247,7 +249,7 @@ Content-Type: text/html; charset=utf-8 <div class="exhibit"><h1 id="fixturama">Fixturama<a href="#fixturama" class="anchor">馃敆</a></h1> <p>A repo that exists to be looked at.</p> </div> -<p class="plaque">README.md 路 49 B 路 <code>9db23702e9</code></p> +<p class="plaque">README.md 路 49 B 路 <code>ced91a8519</code></p> </article></main> </div> <footer class="ground"> @@ -291,7 +293,7 @@ Content-Type: text/html; charset=utf-8 <main><article><h1>with space.txt</h1> <div class="exhibit"><pre class="file">even this filename works </pre></div> -<p class="plaque">docs/with space.txt 路 25 B 路 <code>9db23702e9</code></p> +<p class="plaque">docs/with space.txt 路 25 B 路 <code>ced91a8519</code></p> </article></main> </div> <footer class="ground"> @@ -304,7 +306,7 @@ Content-Type: text/html; charset=utf-8 [testmark]:# (file-at-sha/url) ```text -/fixturama/tree/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f/README.md +/fixturama/tree/ced91a8519b59966124301e6383532f24223528b/README.md ``` [testmark]:# (file-at-sha/response) @@ -318,26 +320,26 @@ Content-Type: text/html; charset=utf-8 <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> -<title>fixturama/README.md @ 9db23702e9</title> +<title>fixturama/README.md @ ced91a8519</title> <link rel="stylesheet" href="/-/style.css"> </head> <body> <div class="flank left"></div><div class="flank right"></div> <div class="sheet"> <nav class="crumbs"> -<a href="/">socle</a><span class="theme">@test</span> / <a href="/fixturama/">fixturama</a> / <a href="/fixturama/tree/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f/">9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f</a> / README.md +<a href="/">socle</a><span class="theme">@test</span> / <a href="/fixturama/">fixturama</a> / <a href="/fixturama/tree/ced91a8519b59966124301e6383532f24223528b/">ced91a8519b59966124301e6383532f24223528b</a> / README.md </nav> <nav class="arc corner" aria-label="page moves" style="padding-bottom:calc(.8rem + 23px)"> -<a class="va" href="/fixturama/raw/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f/README.md" title="the raw bytes" style="--dy:23px">raw</a> -<a class="vb" href="/fixturama/tree/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f/" title="containing directory" style="--dy:2px">up</a> -<a class="vc" href="/fixturama/log/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f" title="commit log of 9db23702e9" style="--dy:2px">log</a> +<a class="va" href="/fixturama/raw/ced91a8519b59966124301e6383532f24223528b/README.md" title="the raw bytes" style="--dy:23px">raw</a> +<a class="vb" href="/fixturama/tree/ced91a8519b59966124301e6383532f24223528b/" title="containing directory" style="--dy:2px">up</a> +<a class="vc" href="/fixturama/log/ced91a8519b59966124301e6383532f24223528b" title="commit log of ced91a8519" style="--dy:2px">log</a> <a class="va" href="/fixturama/" title="repo home" style="--dy:23px">home</a> </nav> <main><article><h1>README.md</h1> <div class="exhibit"><h1 id="fixturama">Fixturama<a href="#fixturama" class="anchor">馃敆</a></h1> <p>A repo that exists to be looked at.</p> </div> -<p class="plaque">README.md 路 49 B 路 <code>9db23702e9</code></p> +<p class="plaque">README.md 路 49 B 路 <code>ced91a8519</code></p> </article></main> </div> <footer class="ground"> @@ -384,7 +386,7 @@ Content-Type: text/html; charset=utf-8 <table class="log"> <thead><tr><th>commit</th><th>date</th><th>author</th><th>subject</th></tr></thead> <tbody> -<tr><td class="hash"><a href="/fixturama/commit/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f">9db23702e9</a></td><td class="date">2026-01-02</td><td>Ada Fixture</td><td>add docs and src</td></tr> +<tr><td class="hash"><a href="/fixturama/commit/ced91a8519b59966124301e6383532f24223528b">ced91a8519</a></td><td class="date">2026-01-02</td><td>Ada Fixture</td><td>add docs and src</td></tr> <tr><td class="hash"><a href="/fixturama/commit/64ac67a35d36079e167cb8f929fd57f859c8b5d1">64ac67a35d</a></td><td class="date">2026-01-02</td><td>Ada Fixture</td><td>inaugurate with a readme</td></tr> </tbody> </table> @@ -406,7 +408,7 @@ A commit with a parent: metadata, message, and a multi-file diff. [testmark]:# (commit-main/url) ```text -/fixturama/commit/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f +/fixturama/commit/ced91a8519b59966124301e6383532f24223528b ``` [testmark]:# (commit-main/response) @@ -420,25 +422,32 @@ Content-Type: text/html; charset=utf-8 <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> -<title>fixturama commit 9db23702e9</title> +<title>fixturama commit ced91a8519</title> <link rel="stylesheet" href="/-/style.css"> </head> <body> <div class="flank left"></div><div class="flank right"></div> <div class="sheet"> <nav class="crumbs"> -<a href="/">socle</a><span class="theme">@test</span> / <a href="/fixturama/">fixturama</a> / commit / 9db23702e9 +<a href="/">socle</a><span class="theme">@test</span> / <a href="/fixturama/">fixturama</a> / commit / ced91a8519 </nav> <nav class="arc corner" aria-label="page moves" style="padding-bottom:calc(.8rem + 10px)"> -<a class="va" href="/fixturama/tree/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f/" title="browse the tree at this commit" style="--dy:10px">files</a> -<a class="vb" href="/fixturama/log/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f" title="the log from this commit" style="--dy:0px">log</a> +<a class="va" href="/fixturama/tree/ced91a8519b59966124301e6383532f24223528b/" title="browse the tree at this commit" style="--dy:10px">files</a> +<a class="vb" href="/fixturama/log/ced91a8519b59966124301e6383532f24223528b" title="the log from this commit" style="--dy:0px">log</a> <a class="vc" href="/fixturama/" title="repo home" style="--dy:10px">home</a> </nav> <main><article><h1>add docs and src</h1> -<p>commit <code>9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f</code> 路 parent <a href="/fixturama/commit/64ac67a35d36079e167cb8f929fd57f859c8b5d1"><code>64ac67a35d</code></a> -路 <a href="/fixturama/tree/9db23702e9ae3e8317b5dba562b0f3bd1cb25e7f/">browse this tree</a><br> +<p>commit <code>ced91a8519b59966124301e6383532f24223528b</code> 路 parent <a href="/fixturama/commit/64ac67a35d36079e167cb8f929fd57f859c8b5d1"><code>64ac67a35d</code></a> +路 <a href="/fixturama/tree/ced91a8519b59966124301e6383532f24223528b/">browse this tree</a><br> Ada Fixture, 2026-01-02 03:04:05 UTC</p> -<pre class="diff"><span class="d-file">diff --git a/docs/notes.md b/docs/notes.md</span> +<pre class="diff"><span class="d-file">diff --git a/.gitignore b/.gitignore</span> +<span class="d-file">new file mode 100644</span> +<span class="d-file">index 0000000..178135c</span> +<span class="d-file">--- /dev/null</span> +<span class="d-file">+++ b/.gitignore</span> +<span class="d-hunk">@@ -0,0 +1 @@</span> +<span class="d-add">+/dist/</span> +<span class="d-file">diff --git a/docs/notes.md b/docs/notes.md</span> <span class="d-file">new file mode 100644</span> <span class="d-file">index 0000000..639f33e</span> <span class="d-file">--- /dev/null</span> @@ -452,13 +461,51 @@ Ada Fixture, 2026-01-02 03:04:05 UTC</p> <span class="d-file">+++ b/docs/with space.txt </span> <span class="d-hunk">@@ -0,0 +1 @@</span> <span class="d-add">+even this filename works</span> +<span class="d-file">diff --git a/src/hello.go b/src/hello.go</span> +<span class="d-file">new file mode 100644</span> +<span class="d-file">index 0000000..8b9f1d6</span> +<span class="d-file">--- /dev/null</span> +<span class="d-file">+++ b/src/hello.go</span> +<span class="d-hunk">@@ -0,0 +1,9 @@</span> +<span class="d-add">+package hello</span> +<span class="d-add">+</span> +<span class="d-add">+import "fmt"</span> +<span class="d-add">+</span> +<span class="d-add">+// Greet says hello from the fixture, at some length:</span> +<span class="d-add">+// the meter wants Go to dominate this repo's composition.</span> +<span class="d-add">+func Greet(name string) string {</span> +<span class="d-add">+ return fmt.Sprintf("hello, %s, from the fixture", name)</span> +<span class="d-add">+}</span> <span class="d-file">diff --git a/src/hello.txt b/src/hello.txt</span> <span class="d-file">new file mode 100644</span> <span class="d-file">index 0000000..b0760d0</span> <span class="d-file">--- /dev/null</span> <span class="d-file">+++ b/src/hello.txt</span> <span class="d-hunk">@@ -0,0 +1 @@</span> -<span class="d-add">+hello from the fixture</span></pre> +<span class="d-add">+hello from the fixture</span> +<span class="d-file">diff --git a/src/lib.rs b/src/lib.rs</span> +<span class="d-file">new file mode 100644</span> +<span class="d-file">index 0000000..987c5fe</span> +<span class="d-file">--- /dev/null</span> +<span class="d-file">+++ b/src/lib.rs</span> +<span class="d-hunk">@@ -0,0 +1,3 @@</span> +<span class="d-add">+pub fn greet(name: &str) -> String {</span> +<span class="d-add">+ format!("hello, {name}")</span> +<span class="d-add">+}</span> +<span class="d-file">diff --git a/src/style.css b/src/style.css</span> +<span class="d-file">new file mode 100644</span> +<span class="d-file">index 0000000..5e06802</span> +<span class="d-file">--- /dev/null</span> +<span class="d-file">+++ b/src/style.css</span> +<span class="d-hunk">@@ -0,0 +1 @@</span> +<span class="d-add">+.hello { color: rebeccapurple; }</span> +<span class="d-file">diff --git a/vendor/mini.js b/vendor/mini.js</span> +<span class="d-file">new file mode 100644</span> +<span class="d-file">index 0000000..633739e</span> +<span class="d-file">--- /dev/null</span> +<span class="d-file">+++ b/vendor/mini.js</span> +<span class="d-hunk">@@ -0,0 +1 @@</span> +<span class="d-add">+export const mini = () => 'vendored';</span></pre> </article></main> </div> <footer class="ground">