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

Commit 91cdeda

Browse files
authored
Merge pull request #522 from devonbarrett/reuse-auth-#521
reuse Auth method when recursing submodules, fixes #521
2 parents 8ddbecf + 63b30fb commit 91cdeda

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

Diff for: repository.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,10 @@ func (r *Repository) clone(ctx context.Context, o *CloneOptions) error {
436436
}
437437

438438
if o.RecurseSubmodules != NoRecurseSubmodules {
439-
if err := w.updateSubmodules(o.RecurseSubmodules); err != nil {
439+
if err := w.updateSubmodules(&SubmoduleUpdateOptions{
440+
RecurseSubmodules: o.RecurseSubmodules,
441+
Auth: o.Auth,
442+
}); err != nil {
440443
return err
441444
}
442445
}

Diff for: worktree.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,22 @@ func (w *Worktree) PullContext(ctx context.Context, o *PullOptions) error {
112112
}
113113

114114
if o.RecurseSubmodules != NoRecurseSubmodules {
115-
return w.updateSubmodules(o.RecurseSubmodules)
115+
return w.updateSubmodules(&SubmoduleUpdateOptions{
116+
RecurseSubmodules: o.RecurseSubmodules,
117+
Auth: o.Auth,
118+
})
116119
}
117120

118121
return nil
119122
}
120123

121-
func (w *Worktree) updateSubmodules(recursion SubmoduleRescursivity) error {
124+
func (w *Worktree) updateSubmodules(o *SubmoduleUpdateOptions) error {
122125
s, err := w.Submodules()
123126
if err != nil {
124127
return err
125128
}
126-
127-
return s.Update(&SubmoduleUpdateOptions{
128-
Init: true,
129-
RecurseSubmodules: recursion,
130-
})
129+
o.Init = true
130+
return s.Update(o)
131131
}
132132

133133
// Checkout switch branches or restore working tree files.

0 commit comments

Comments
 (0)