diff options
-rw-r--r-- | repository.go | 5 | ||||
-rw-r--r-- | worktree.go | 14 |
2 files changed, 11 insertions, 8 deletions
diff --git a/repository.go b/repository.go index 00ffaf7..7f5b793 100644 --- a/repository.go +++ b/repository.go @@ -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 } } diff --git a/worktree.go b/worktree.go index 4e4d544..60c8adb 100644 --- a/worktree.go +++ b/worktree.go @@ -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. |