aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-04-07 17:26:02 +0200
committerGitHub <noreply@github.com>2020-04-07 17:26:02 +0200
commit9c2ab26437152c9a92f66afb51a28c0142f704ad (patch)
treee82447e0fa27fccaf891e3a61dc6c20d3bbf3a09 /plumbing/transport
parent8fddd7abcc436d77e9f7449a7b7aa15ee13f7c60 (diff)
parent7f7ab529081953fb91783301b5f4eb3c5d2dfdb0 (diff)
downloadgo-git-9c2ab26437152c9a92f66afb51a28c0142f704ad.tar.gz
Merge pull request #22 from mcuadros/fix-empty
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