aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/repository.go b/repository.go
index f4aa26d..87810a6 100644
--- a/repository.go
+++ b/repository.go
@@ -67,6 +67,10 @@ func (r *Repository) Pull(remoteName, branch string) (err error) {
return err
}
+ if branch == "" {
+ branch = remote.DefaultBranch()
+ }
+
ref, err := remote.Ref(branch)
if err != nil {
return err
@@ -93,12 +97,7 @@ func (r *Repository) Pull(remoteName, branch string) (err error) {
// 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())
+ return r.Pull(DefaultRemoteName, "")
}
// Commit return the commit with the given hash