aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-10-23 02:26:15 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2015-10-23 02:26:15 +0200
commite1d8866ffa78fa16d2f39b0ba5344a7269ee5371 (patch)
tree4602b0ca341187aad77048f807cde423af410554 /remote.go
parent2275fa7d0c75d20103f90b0e1616937d5a9fc5e6 (diff)
downloadgo-git-e1d8866ffa78fa16d2f39b0ba5344a7269ee5371.tar.gz
clients and remote: fetch implementation
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go14
1 files changed, 14 insertions, 0 deletions
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},
+ })
+}