From e1d8866ffa78fa16d2f39b0ba5344a7269ee5371 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Fri, 23 Oct 2015 02:26:15 +0200 Subject: clients and remote: fetch implementation --- remote.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'remote.go') diff --git a/remote.go b/remote.go index 100bc5c..715d71e 100644 --- a/remote.go +++ b/remote.go @@ -1,6 +1,8 @@ package git import ( + "io" + "gopkg.in/src-d/go-git.v2/clients" "gopkg.in/src-d/go-git.v2/clients/common" ) @@ -48,3 +50,15 @@ func (r *Remote) Capabilities() common.Capabilities { func (r *Remote) DefaultBranch() string { return r.upInfo.Capabilities.SymbolicReference("HEAD") } + +// Fetch returns a reader using the request +func (r *Remote) Fetch(req *common.GitUploadPackRequest) (io.ReadCloser, error) { + return r.upSrv.Fetch(req) +} + +// FetchDefaultBranch returns a reader for the default branch +func (r *Remote) FetchDefaultBranch() (io.ReadCloser, error) { + return r.Fetch(&common.GitUploadPackRequest{ + Want: []string{r.upInfo.Refs[r.DefaultBranch()].Id}, + }) +} -- cgit