Skip to content

pull_request_create pushes a branch to its own push target, not the pinned repository #483

Done

Description

@shuv1337

Found in review of #482 (upstream sync to cd128e7774), left out of that PR on purpose.

Upstream's pull_request_create now pushes the branch before opening the pull request (pushAndOpenPullRequest in apps/server/src/git/GitManager.ts). Since #480 and #482 the pull request itself is pinned to origin's repository before any push. The push is not pinned: pushCurrentBranch (apps/server/src/vcs/GitVcsDriverCore.ts) follows the branch's own push target.

Problem

In a fork checkout, a local branch that tracks upstream/<same name> is pushed to upstream while the pull request is created against origin.

  • Without write access to upstream (the normal case) the push fails and the create fails with it. Nothing reaches upstream.
  • With write access, a branch would be published on the upstream repository.

Suggested fix

When the create is pinned to a repository, push to the remote that matches the pin, or refuse with a typed error when the branch's push target is a different repository. Add a case to the createPullRequest tests in GitManager.test.ts: branch tracks upstream/<name>, create with no repository named, assert no ref is created on the upstream remote.

Related: #479, #481.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions