aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-04-25 08:57:48 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-04-25 08:57:48 +0200
commit74b8b53b28d444542edc77e0beec19bbab8e8037 (patch)
treed311444af46cc4b24e48ce5f8b86da99f28585c1 /repository.go
parenta84f6e9637d5fac2fb5a6164b633ed07c9a0a8e6 (diff)
downloadgo-git-74b8b53b28d444542edc77e0beec19bbab8e8037.tar.gz
remote.Head and repository.PullDefault
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/repository.go b/repository.go
index ae583fd..f4aa26d 100644
--- a/repository.go
+++ b/repository.go
@@ -91,6 +91,16 @@ func (r *Repository) Pull(remoteName, branch string) (err error) {
return nil
}
+// PullDefault like Pull but retrieve the default branch from the default remote
+func (r *Repository) PullDefault() (err error) {
+ remote, ok := r.Remotes[DefaultRemoteName]
+ if !ok {
+ return fmt.Errorf("unable to find default remote %q", DefaultRemoteName)
+ }
+
+ return r.Pull(DefaultRemoteName, remote.DefaultBranch())
+}
+
// Commit return the commit with the given hash
func (r *Repository) Commit(h core.Hash) (*Commit, error) {
obj, err := r.Storage.Get(h)