tinyrelaycommit

Commit 204f6c008c44

browse files at this commit | history

1diff --git a/internal/gitrelay/gitrelay_test.go b/internal/gitrelay/gitrelay_test.go
2index 5c112ec..080bc87 100644
3--- a/internal/gitrelay/gitrelay_test.go
4+++ b/internal/gitrelay/gitrelay_test.go
5@@ -695,6 +695,29 @@ func TestSmartHTTPServesBareRepository(t *testing.T) {
6 if _, err := os.Stat(filepath.Join(root, "git", owner, "http.git", "HEAD")); err != nil {
7 t.Fatalf("repo: %v", err)
8 }
9+ // Git 2.39 does not include upload-pack capabilities in an advertisement
10+ // for an empty repository. Seed one valid commit so this exercises the
11+ // capability negotiation used by browser clients.
12+ repo := g.repoPath(r)
13+ treeCmd := exec.Command("git", "--git-dir", repo, "mktree")
14+ treeCmd.Stdin = strings.NewReader("")
15+ tree, err := treeCmd.Output()
16+ if err != nil {
17+ t.Fatalf("empty tree: %v", err)
18+ }
19+ commitCmd := exec.Command("git", "--git-dir", repo, "commit-tree", strings.TrimSpace(string(tree)), "-m", "initial state")
20+ commitCmd.Env = append(os.Environ(),
21+ "GIT_AUTHOR_NAME=tinyrelay test", "GIT_AUTHOR_EMAIL=test@example.invalid",
22+ "GIT_COMMITTER_NAME=tinyrelay test", "GIT_COMMITTER_EMAIL=test@example.invalid",
23+ )
24+ commit, err := commitCmd.Output()
25+ if err != nil {
26+ t.Fatalf("initial commit: %v", err)
27+ }
28+ update := exec.Command("git", "--git-dir", repo, "update-ref", "refs/heads/main", strings.TrimSpace(string(commit)))
29+ if out, err := update.CombinedOutput(); err != nil {
30+ t.Fatalf("initial ref: %v: %s", err, out)
31+ }
32 req := httptest.NewRequest(http.MethodGet, "/npub/npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6/http.git/info/refs?service=git-upload-pack", nil)
33 if got, err := decodeNPub("npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6"); err != nil {
34 t.Fatalf("known npub: %v", err)

About

ownerc01503e8035f
visibilitypublic
head204f6c008c44

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs