aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/ulreq.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/protocol/packp/ulreq.go')
-rw-r--r--plumbing/protocol/packp/ulreq.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/plumbing/protocol/packp/ulreq.go b/plumbing/protocol/packp/ulreq.go
index 254e85e..d57c3fc 100644
--- a/plumbing/protocol/packp/ulreq.go
+++ b/plumbing/protocol/packp/ulreq.go
@@ -25,6 +25,7 @@ type UploadRequest struct {
// DepthCommit, DepthSince and DepthReference.
type Depth interface {
isDepth()
+ IsZero() bool
}
// DepthCommits values stores the maximum number of requested commits in
@@ -34,16 +35,28 @@ type DepthCommits int
func (d DepthCommits) isDepth() {}
+func (d DepthCommits) IsZero() bool {
+ return d == 0
+}
+
// DepthSince values requests only commits newer than the specified time.
type DepthSince time.Time
func (d DepthSince) isDepth() {}
+func (d DepthSince) IsZero() bool {
+ return time.Time(d).IsZero()
+}
+
// DepthReference requests only commits not to found in the specified reference.
type DepthReference string
func (d DepthReference) isDepth() {}
+func (d DepthReference) IsZero() bool {
+ return string(d) == ""
+}
+
// NewUploadRequest returns a pointer to a new UploadRequest value, ready to be
// used. It has no capabilities, wants or shallows and an infinite depth. Please
// note that to encode an upload-request it has to have at least one wanted hash.