Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down