aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/uppackreq.go
diff options
context:
space:
mode:
authorArieh Schneier <15041913+AriehSchneier@users.noreply.github.com>2023-07-02 22:51:41 +1000
committerArieh Schneier <15041913+AriehSchneier@users.noreply.github.com>2023-07-02 22:51:41 +1000
commit025e1311f8473f65facf8cffeccc11e39466db4a (patch)
tree9eb4595171862dbbf92c88de57bc410bdbc7b12c /plumbing/protocol/packp/uppackreq.go
parent99ccca6bc543f88a18df50763d5fc13808e053e4 (diff)
downloadgo-git-025e1311f8473f65facf8cffeccc11e39466db4a.tar.gz
plumbing: packp, A request is not empty if it contains shallows. Fixes #328
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
Diffstat (limited to 'plumbing/protocol/packp/uppackreq.go')
-rw-r--r--plumbing/protocol/packp/uppackreq.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/plumbing/protocol/packp/uppackreq.go b/plumbing/protocol/packp/uppackreq.go
index de2206b..48f4438 100644
--- a/plumbing/protocol/packp/uppackreq.go
+++ b/plumbing/protocol/packp/uppackreq.go
@@ -38,10 +38,10 @@ func NewUploadPackRequestFromCapabilities(adv *capability.List) *UploadPackReque
}
}
-// IsEmpty a request if empty if Haves are contained in the Wants, or if Wants
-// length is zero
+// IsEmpty returns whether a request is empty - it is empty if Haves are contained
+// in the Wants, or if Wants length is zero, and we don't have any shallows
func (r *UploadPackRequest) IsEmpty() bool {
- return isSubset(r.Wants, r.Haves)
+ return isSubset(r.Wants, r.Haves) && len(r.Shallows) == 0
}
func isSubset(needle []plumbing.Hash, haystack []plumbing.Hash) bool {