Skip to content

Clicking on a PR from a fork does nothing #3395

Closed

Description

@joshaber

if (isRefInThisRepo) {
this.checkoutBranch(head.ref)
} else {
// TODO: It's in a fork so we'll need to do ... something.
}

Activity

  1. added
    bug
    on Nov 21, 2017
  2. added this to the 1.1 milestone on Nov 21, 2017
  3. joshaber commented on Nov 21, 2017

    @joshaber
    ContributorAuthor

    Probably we should add the fork's remote and then check out the ref? This could be a bummer since your list of remotes will grow over time.

    We could check out the pull request ref, but then we couldn't push to it if it allowed maintainer collaboration.

    @desktop/core @desktop/design Thoughts?

  4. joshaber commented on Dec 6, 2017

    @joshaber
    ContributorAuthor

    @niik and I talked about this yesterday and agreed that for 1.1, checking out the PR ref is the best route forward. That means we'll also need to explicitly fetch the PR ref (e.g., git fetch origin pull/:pr_number/head).

  5. self-assigned this
    on Dec 6, 2017
  6. shiftkey commented on Dec 7, 2017

    @shiftkey
    Member

    Some prior art: the "Clone in Desktop" flow handles PRs from forks.

    private async handleCloneInDesktopOptions(
    repository: Repository,
    action: IOpenRepositoryFromURLAction
    ): Promise<void> {
    const { filepath, pr, branch } = action
    if (pr && branch) {
    // we need to refetch for a forked PR and check that out
    await this.fetchRefspec(repository, `pull/${pr}/head:${branch}`)
    }
    if (branch) {
    await this.checkoutBranch(repository, branch)
    }
    if (filepath) {
    const fullPath = Path.join(repository.path, filepath)
    // because Windows uses different path separators here
    const normalized = Path.normalize(fullPath)
    shell.showItemInFolder(normalized)
    }
    }

    Feel free to steal liberally.

  7. iAmWillShepherd commented on Dec 14, 2017

    @iAmWillShepherd
    Contributor

    Something to consider is if a user adds a remote under our namespace then the URL may not be what we expect, what do we do?

    Also Windows has a path length limit, our remote names could cause problems.

  8. locked as resolved and limited conversation to collaborators on Jul 18, 2018
  9. 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

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions