From 7f7ab529081953fb91783301b5f4eb3c5d2dfdb0 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 7 Apr 2020 09:37:34 +0200 Subject: plumbing: transport, fix handling of empty adv-refs on upload-pack --- plumbing/transport/internal/common/common.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plumbing/transport/internal') diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go index d564d25..89432e3 100644 --- a/plumbing/transport/internal/common/common.go +++ b/plumbing/transport/internal/common/common.go @@ -175,6 +175,13 @@ func (s *session) AdvertisedReferences() (*packp.AdvRefs, error) { } } + // Some servers like jGit, announce capabilities instead of returning an + // packp message with a flush. This verifies that we received a empty + // adv-refs, even it contains capabilities. + if !s.isReceivePack && ar.IsEmpty() { + return nil, transport.ErrEmptyRemoteRepository + } + transport.FilterUnsupportedCapabilities(ar.Capabilities) s.advRefs = ar return ar, nil -- cgit