diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-04-25 08:57:48 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-04-25 08:57:48 +0200 |
commit | 74b8b53b28d444542edc77e0beec19bbab8e8037 (patch) | |
tree | d311444af46cc4b24e48ce5f8b86da99f28585c1 /repository.go | |
parent | a84f6e9637d5fac2fb5a6164b633ed07c9a0a8e6 (diff) | |
download | go-git-74b8b53b28d444542edc77e0beec19bbab8e8037.tar.gz |
remote.Head and repository.PullDefault
Diffstat (limited to 'repository.go')
-rw-r--r-- | repository.go | 10 |
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) |