Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
reuse Auth method when recursing submodules, fixes #521
Browse files Browse the repository at this point in the history
  • Loading branch information
devonbarrett committed Jul 29, 2017
1 parent 8ddbecf commit 63b30fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {
}

if o.RecurseSubmodules != NoRecurseSubmodules {
if err := w.updateSubmodules(o.RecurseSubmodules); err != nil {
if err := w.updateSubmodules(&SubmoduleUpdateOptions{
RecurseSubmodules: o.RecurseSubmodules,
Auth: o.Auth,
}); err != nil {
return err
}
}
Expand Down
14 changes: 7 additions & 7 deletions worktree.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ func (w *Worktree) PullContext(ctx context.Context, o *PullOptions) error {
}

if o.RecurseSubmodules != NoRecurseSubmodules {
return w.updateSubmodules(o.RecurseSubmodules)
return w.updateSubmodules(&SubmoduleUpdateOptions{
RecurseSubmodules: o.RecurseSubmodules,
Auth: o.Auth,
})
}

return nil
}

func (w *Worktree) updateSubmodules(recursion SubmoduleRescursivity) error {
func (w *Worktree) updateSubmodules(o *SubmoduleUpdateOptions) error {
s, err := w.Submodules()
if err != nil {
return err
}

return s.Update(&SubmoduleUpdateOptions{
Init: true,
RecurseSubmodules: recursion,
})
o.Init = true
return s.Update(o)
}

// Checkout switch branches or restore working tree files.
Expand Down

0 comments on commit 63b30fb

Please sign in to comment.