aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-11-17 09:20:58 +0000
committerGitHub <noreply@github.com>2023-11-17 09:20:58 +0000
commit6d62dd1250a41ffe6d04794fb2e460456ebaea91 (patch)
tree457bdb9c097e8a7fb2406baebf298e45de71944b /plumbing
parent226d25b5ee3194bf7c13457927c4d400e802daaf (diff)
parent05551b70f689944ab558a2b326b2174f313d372a (diff)
downloadgo-git-6d62dd1250a41ffe6d04794fb2e460456ebaea91.tar.gz
Merge pull request #932 from aymanbagabas/fix-empty
plumbing: fix empty uploadpack request error
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/transport/internal/common/common.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go
index 6574116..da1c2ac 100644
--- a/plumbing/transport/internal/common/common.go
+++ b/plumbing/transport/internal/common/common.go
@@ -245,6 +245,12 @@ func (s *session) handleAdvRefDecodeError(err error) error {
// returned with the packfile content. The reader must be closed after reading.
func (s *session) UploadPack(ctx context.Context, req *packp.UploadPackRequest) (*packp.UploadPackResponse, error) {
if req.IsEmpty() {
+ // XXX: IsEmpty means haves are a subset of wants, in that case we have
+ // everything we asked for. Close the connection and return nil.
+ if err := s.finish(); err != nil {
+ return nil, err
+ }
+ // TODO:(v6) return nil here
return nil, transport.ErrEmptyUploadPackRequest
}