Skip to content

optimization: avoid a fetch when checkout out a pull request #4068

Closed

Description

@shiftkey

In #4057 @niik mentions an opportunity to avoid a fetch if we know the branch exists:

      // TODO: I think we could skip this fetch if we know that we have the branch locally
      // already. That way we'd match the behavior of checking out a branch.
      if (defaultRemote) {
        await this._fetchRemote(
          repository,
          defaultRemote,
          FetchType.UserInitiatedTask
        )
      }

I'll let @niik add any additional thoughts on the best approach here.

Activity

  1. added
    help wanted
    on Feb 22, 2018
  2. agisilaos commented on Feb 24, 2018

    @agisilaos
    Member

    Would be more than happy to pick this up @shiftkey 💯

  3. agisilaos commented on Feb 24, 2018

    @agisilaos
    Member

    @shiftkey Is it possible to report the comment above as spam? because I don't have this option available.
    screen shot 2018-02-24 at 18 41 14

  4. iAmWillShepherd commented on Feb 27, 2018

    @iAmWillShepherd
    Contributor

    @agisilaos. Go for it! I'll add it to our project board for tracking issues our community have claimed.

  5. agisilaos commented on Mar 2, 2018

    @agisilaos
    Member

    @niik Before I start working on this, I would love to know your additional thoughts or any other info that may help me during the process.

  6. iAmWillShepherd commented on Mar 2, 2018

    @iAmWillShepherd
    Contributor

    @agisilaos , when you open your PR, can you be sure to include Fixes #4068 at the top of the PR body?

  7. agisilaos commented on Mar 2, 2018

    @agisilaos
    Member

    Of course 🌮 @iAmWillShepherd

  8. niik commented on Mar 12, 2018

    @niik
    Member

    Before I start working on this, I would love to know your additional thoughts or any other info that may help me during the process.

    I believe I was referring to using the same logic that already exists in the forked-case:

    const doesBranchExist =
    gitStore.allBranches.find(branch => branch.name === localBranchName) !=
    null
    if (!doesBranchExist) {
    await this._createBranch(
    repository,
    localBranchName,
    `${remoteName}/${head.ref}`
    )
    }

    So I'd say the work consists of extracting that logic into something reusable and then verifying that my assumption was correct in the first place.

  9. agisilaos commented on Mar 14, 2018

    @agisilaos
    Member

    Just finished working on this one. Will create a PR soon @niik!

  10. agisilaos commented on Mar 14, 2018

    @agisilaos
    Member

    PR #4240 is up! 💯

  11. locked as resolved and limited conversation to collaborators on Jul 17, 2018
  12. unlocked this conversation on Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions