gitworkshop.dev fetches one commit at a time in the browser and refuses a server whose advertisement lacks the filter capability, so every fetch of a repository hosted here failed at what it called the transport level. Pass uploadpack.allowFilter and uploadpack.allowAnySHA1InWant to http-backend, matching what the other GRASP servers advertise.
- commit
- f424095cdafdb13a77f50fbb524e6a705c38638b
- parent
- bce2c385a5446e762a7bd6b19b6b98aa37b49f32
- author
- Dami <dami.etoile@gmail.com>
| M | internal/ | 5 | ++++- |
| M | internal/ | 9 | ++++++++- |
@@ -1893,7 +1893,10 @@ func (g *GitRelay) cgi(req *http.Request, w http.ResponseWriter, r Repository, s
18931893 pathInfo := prefix + "/" + r.Owner + "/" + r.Identifier + ".git" + suffix18941894 ctx, cancel := context.WithCancel(req.Context())18951895 defer cancel()1896- cmd := exec.CommandContext(ctx, "git", "http-backend")1896+ // Browser clients such as gitworkshop.dev fetch one commit at a time with1897+ // a filter, and refuse servers that do not advertise filter and1898+ // sha1-in-want. The -c settings reach upload-pack through the environment.1899+ cmd := exec.CommandContext(ctx, "git", "-c", "uploadpack.allowFilter=true", "-c", "uploadpack.allowAnySHA1InWant=true", "http-backend")18971900 cmd.Dir = g.root18981901 cmd.WaitDelay = 5 * time.Second18991902 stdin, contentLength, cleanup, err := cgiInput(req)@@ -710,9 +710,16 @@ func TestSmartHTTPServesBareRepository(t *testing.T) {
710710 if res.Code != http.StatusOK {711711 t.Fatalf("smart HTTP status = %d: %s", res.Code, res.Body.String())712712 }713- if body, _ := io.ReadAll(res.Result().Body); len(body) == 0 {713+ body, _ := io.ReadAll(res.Result().Body)714+ if len(body) == 0 {714715 t.Fatal("smart HTTP returned an empty advertisement")715716 }717+ // gitworkshop.dev and other browser clients require these capabilities.718+ for _, capability := range []string{" filter", " allow-tip-sha1-in-want", " allow-reachable-sha1-in-want", " object-format=sha1"} {719+ if !strings.Contains(string(body), capability) {720+ t.Errorf("advertisement lacks %q: %s", strings.TrimSpace(capability), body)721+ }722+ }716723 }717724 718725 func TestPendingStatePromotesAfterAuthorizedGitPush(t *testing.T) {