From d1fec8cfb0993f6bd541ae0eabac9a805e3963ba Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Thu, 28 May 2026 23:10:13 -0400 Subject: [PATCH] test(http): tidy parity-test literals and stale comment --- cmd/objgitd/http_test.go | 20 ++++++++++++++------ docs/usage/hooks.md | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cmd/objgitd/http_test.go b/cmd/objgitd/http_test.go index 732b668..458c602 100644 --- a/cmd/objgitd/http_test.go +++ b/cmd/objgitd/http_test.go @@ -14,8 +14,8 @@ import ( ) // TestSmartHTTP drives a real git client against the smart-HTTP handler over an -// in-memory filesystem, covering push (create-on-demand), the allowPush gate, -// and clone round-trips. +// in-memory filesystem, covering push (create-on-demand), the write-gate +// enforced by the authorizer, and clone round-trips. func TestSmartHTTP(t *testing.T) { if _, err := exec.LookPath("git"); err != nil { t.Skip("git not installed") @@ -123,8 +123,12 @@ func TestSmartHTTPAnonymousReadWhilePushDisabled(t *testing.T) { // Seed a repo via a push-enabled server over a shared filesystem. fs := memfs.New() - seed := httptest.NewServer(&daemon{fs: fs, loader: transport.NewFilesystemLoader(fs, false), authz: auth.AllowAnonymous{AllowWrite: true}}) - defer seed.Close() + seed := httptest.NewServer(&daemon{ + fs: fs, + loader: transport.NewFilesystemLoader(fs, false), + authz: auth.AllowAnonymous{AllowWrite: true}, + }) + t.Cleanup(seed.Close) work := seedRepo(t) srcHead := strings.TrimSpace(runGit(t, work, "rev-parse", "HEAD")) @@ -133,8 +137,12 @@ func TestSmartHTTPAnonymousReadWhilePushDisabled(t *testing.T) { } // Serve the same filesystem with push disabled and clone from it. - ro := httptest.NewServer(&daemon{fs: fs, loader: transport.NewFilesystemLoader(fs, false), authz: auth.AllowAnonymous{AllowWrite: false}}) - defer ro.Close() + ro := httptest.NewServer(&daemon{ + fs: fs, + loader: transport.NewFilesystemLoader(fs, false), + authz: auth.AllowAnonymous{AllowWrite: false}, + }) + t.Cleanup(ro.Close) dst := t.TempDir() if out, err := tryGit(dst, "clone", ro.URL+"/test.git", "cloned"); err != nil { diff --git a/docs/usage/hooks.md b/docs/usage/hooks.md index 242e3b6..ccc25f5 100644 --- a/docs/usage/hooks.md +++ b/docs/usage/hooks.md @@ -110,8 +110,8 @@ ls /src # Read a file out of the push. if [ -f /src/go.mod ]; then - module="$(head -n 1 /src/go.mod | cut -d' ' -f2)" - echo "go module: ${module}" + module="$(head -n 1 /src/go.mod | cut -d' ' -f2)" + echo "go module: ${module}" fi # Scratch work goes in /tmp. -- 2.51.2