diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-29 14:20:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-29 14:20:30 +0200 |
commit | 91cdedae7faffca0a707fa47780efafe157ba47c (patch) | |
tree | 282c7bc5b476ad21c4cbfad63c74b36d338cb5d1 | |
parent | 8ddbecf782c2e340fd85bb4ba4d00dc73d749f87 (diff) | |
parent | 63b30fba572b7e70833fae4785c6d22f167c6641 (diff) | |
download | go-git-91cdedae7faffca0a707fa47780efafe157ba47c.tar.gz |
Merge pull request #522 from devonbarrett/reuse-auth-#521
reuse Auth method when recursing submodules, fixes #521
-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. |