diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-23 02:26:15 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-23 02:26:15 +0200 |
commit | e1d8866ffa78fa16d2f39b0ba5344a7269ee5371 (patch) | |
tree | 4602b0ca341187aad77048f807cde423af410554 /remote.go | |
parent | 2275fa7d0c75d20103f90b0e1616937d5a9fc5e6 (diff) | |
download | go-git-e1d8866ffa78fa16d2f39b0ba5344a7269ee5371.tar.gz |
clients and remote: fetch implementation
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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}, + }) +} |