aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
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)