aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-04-07 09:37:34 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2020-04-07 09:37:34 +0200
commit7f7ab529081953fb91783301b5f4eb3c5d2dfdb0 (patch)
treecabd1ddd923bac0ac052b0187a35469a00cf368a /plumbing/transport
parente04168bb11a960018b6bbabd6972fd33163b6f28 (diff)
downloadgo-git-7f7ab529081953fb91783301b5f4eb3c5d2dfdb0.tar.gz
plumbing: transport, fix handling of empty adv-refs on upload-pack
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/internal/common/common.go7
1 files changed, 7 insertions, 0 deletions
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