summaryrefslogtreecommitdiff
path: root/go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go')
-rw-r--r--go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go b/go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go
new file mode 100644
index 0000000..5ddfbc2
--- /dev/null
+++ b/go/vendor/gitlab.com/gitlab-org/gitaly-proto/go/helper/inforefs.go
@@ -0,0 +1,32 @@
+package helper
+
+import (
+ "io"
+
+ pb "gitlab.com/gitlab-org/gitaly-proto/go"
+)
+
+type InfoRefsClient interface {
+ Recv() (*pb.InfoRefsResponse, error)
+}
+
+type InfoRefsClientWriterTo struct {
+ InfoRefsClient
+}
+
+func (clientReader *InfoRefsClientWriterTo) WriteTo(w io.Writer) (total int64, err error) {
+ for {
+ response, err := clientReader.Recv()
+ if err == io.EOF {
+ return total, nil
+ } else if err != nil {
+ return total, err
+ }
+
+ n, err := w.Write(response.GetData())
+ total += int64(n)
+ if err != nil {
+ return total, err
+ }
+ }
+}