Skip to content

Default to creating pull request for base repository on file edit #34239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

brechtvl
Copy link
Contributor

  • When editing the default branch and there is a base repository, make the default commit choice creating a new branch.
  • When creating the pull request, default compare it against the base repository default branch. This matches the behavior of creating a pull request based on a branch elsewhere in the UI.

This makes it easier to do the right thing for contributing changes from a fork.

* When editing the default branch and there is a base repository, make
  the default commit choice creating a new branch.
* When creating the pull request, default compare it against the base
  repository default branch. This matches the behavior of creating
  a pull request based on a branch elsewhere in the UI.

This makes it easier to do the right thing for contributing changes
from a fork.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 18, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 18, 2025
redirectToPullRequest = true
baseBranch = repo.BaseRepo.DefaultBranch
headBranch = repo.Owner.Name + "/" + repo.Name + ":" + headBranch
repo = repo.BaseRepo
} else if repo.UnitEnabled(ctx, unit.TypePullRequests) {
redirectToPullRequest = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand the change, and it doesn't match the comment "// Redirect to a pull request when possible" above now.

Please add more comments for the details and it's better to have some tests to clarify the behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments now.

Note that whether or not it redirects to the pull request is not changed by this. Just which repository and branch is the default choice in the pull request.

For testing I'll have a look later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants