Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Context is not passed when updating submodules  #1098

Copy link
Copy link
Closed
@onee-only

Description

@onee-only
Issue body actions

When pulling or cloning from a repo, go-git will update submodules if the option is set.

The problem is when calling (*Worktree).updateSubmodules. It doesn't take the context from a caller.

go-git/worktree.go

Lines 151 to 158 in c7feada

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

It creates new context internally.

go-git/submodule.go

Lines 298 to 301 in c7feada

// Update updates all the submodules in this list.
func (s Submodules) Update(o *SubmoduleUpdateOptions) error {
return s.UpdateContext(context.Background(), o)
}

This can lead to situations where we can't gracefully handle slow fetching of submodules or etc.

Is there any reason that it ignores context from caller?
If there isn't, I think we better pass context to the funciton.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.