From abe49196b80e367f7cc123a095b32958f8d0470b Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Sat, 1 Jul 2023 15:37:24 +0100 Subject: plumbing: http, Fix empty repos on Git v2.41+ Git v2.41.0 comes with [changes](https://github.com/git/git/commit/933e3a4ee205353d8f093d5dfcd226fa432c4e58) that breaks go-git's assumptions for when detecting empty repositories. Go-git expects a flush instead of the first hash line. Instead, a dummy capabilities^{} with zero-id is returned. The change aims to allow for identifying the object format even when cloning empty repositories. Signed-off-by: Paulo Gomes --- plumbing/protocol/packp/advrefs_decode_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'plumbing/protocol/packp/advrefs_decode_test.go') diff --git a/plumbing/protocol/packp/advrefs_decode_test.go b/plumbing/protocol/packp/advrefs_decode_test.go index 83b0b01..d127145 100644 --- a/plumbing/protocol/packp/advrefs_decode_test.go +++ b/plumbing/protocol/packp/advrefs_decode_test.go @@ -218,6 +218,16 @@ func (s *AdvRefsDecodeSuite) TestCaps(c *C) { {Name: capability.SymRef, Values: []string{"HEAD:refs/heads/master"}}, {Name: capability.Agent, Values: []string{"foo=bar"}}, }, + }, { + input: []string{ + "0000000000000000000000000000000000000000 capabilities^{}\x00report-status report-status-v2 delete-refs side-band-64k quiet atomic ofs-delta object-format=sha1 agent=git/2.41.0\n", + pktline.FlushString, + }, + capabilities: []entry{ + {Name: capability.ReportStatus, Values: []string(nil)}, + {Name: capability.ObjectFormat, Values: []string{"sha1"}}, + {Name: capability.Agent, Values: []string{"git/2.41.0"}}, + }, }} { ar := s.testDecodeOK(c, test.input) for _, fixCap := range test.capabilities { -- cgit