Skip to content
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

cant Pull request inside a forked repo #6318

Closed
1 of 3 tasks
salco opened this issue Mar 13, 2019 · 17 comments · Fixed by #21519
Closed
1 of 3 tasks

cant Pull request inside a forked repo #6318

salco opened this issue Mar 13, 2019 · 17 comments · Fixed by #21519
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Milestone

Comments

@salco
Copy link

salco commented Mar 13, 2019

Description

If a pull request is open from a forked repo, it will automatically be apply to the source it's forked.
The issue is that we can only see the branch from the source that we've forked and we are unable to easily change the target to apply the pull request.

The only "hack" we can do is change the username or the organisation targeted inside the URL to be able to get the correct usage.

By default I think we need to be able to do pull request inside the repo we work, even if it's a fork.
...

@lunny
Copy link
Member

lunny commented Mar 14, 2019

duplicated with #6225 ?

@zeripath
Copy link
Contributor

Hmm, I'm not certain if this is the same.

So when you click on PullRequest from a fork it is assumed that you want to merge into the original repository not the fork.

Now, there's no way of changing the base repository easily except to change the URL by hand.

The UI for compare needs to allow you to select the fork repository branches to merge in, and needs to allow you to suggest other repositories. Similarly we need to allow users to change repository for the pulled branch.

@salco
Copy link
Author

salco commented Mar 15, 2019

Exact and I think it's best if the "default" PullRequest suggested need to be the repository where the PullRequest is created.

@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 16, 2019
@stale
Copy link

stale bot commented May 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label May 15, 2019
@stale
Copy link

stale bot commented May 29, 2019

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this as completed May 29, 2019
@wpmp
Copy link

wpmp commented Aug 2, 2019

Has this issue been resolved?

@zeripath zeripath reopened this Aug 2, 2019
@stale stale bot removed the issue/stale label Aug 2, 2019
@zeripath
Copy link
Contributor

zeripath commented Aug 2, 2019

The compare diff page needs to be rewritten to allow for easy changes to the base repo and head repo

raycrasher added a commit to raycrasher/gitea that referenced this issue Aug 8, 2019
Signed-off-by: Ian David Garcia <cinquedia@gmail.com>
@stale
Copy link

stale bot commented Oct 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Oct 1, 2019
@sapk sapk added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Oct 1, 2019
@stale stale bot removed the issue/stale label Oct 1, 2019
@dloez
Copy link

dloez commented Nov 25, 2021

Upgraded to Version 1.15.6, this is still happening.

@creamteam-de
Copy link

we have also the same problem in the latest version :(. Is there any plan to fix it?

@lunny
Copy link
Member

lunny commented Dec 24, 2021

Hm, what's the problem? Could you show some screenshots or logs? Maybe this is the different thing from before?

@salco
Copy link
Author

salco commented Dec 25, 2021

Was it working in 1.15.3 for us it work fine, but we did not try upgrading to 1.15.6 for the moment.

@dloez
Copy link

dloez commented Dec 27, 2021

We have a main repository, let's call it "main-repo", and a forked repository of "main-repo" called "forked-repo". Both repositories share "master" and "develop" branches. If you create a new branch on "forked-repo" (let's say "new-branch") and then try to create a PR it shows a 404 page. In the URL you can see that gitea tried to point to "main-repo" instead of "forked-repo". If you change the URL by hand, instead of pointing to "main-repo - new-branch" point to "forked-repo - new-branch" it then works. It wasn´t working either for us on the previous version that we were using (1.12.5). We used others versions (1.9.2, 1.11.1, 1.11.5, 1.12.1, 1.12.5, 1.15.6) but cannot confirm that PRs weren´t working back then because we didn´t use them.

I cannot see anything related on the logs.
image

@lunny
Copy link
Member

lunny commented Dec 31, 2021

We have a main repository, let's call it "main-repo", and a forked repository of "main-repo" called "forked-repo". Both repositories share "master" and "develop" branches. If you create a new branch on "forked-repo" (let's say "new-branch") and then try to create a PR it shows a 404 page. In the URL you can see that gitea tried to point to "main-repo" instead of "forked-repo". If you change the URL by hand, instead of pointing to "main-repo - new-branch" point to "forked-repo - new-branch" it then works. It wasn´t working either for us on the previous version that we were using (1.12.5). We used others versions (1.9.2, 1.11.1, 1.11.5, 1.12.1, 1.12.5, 1.15.6) but cannot confirm that PRs weren´t working back then because we didn´t use them.

I cannot see anything related on the logs. image

Can you reproduce that in https://try.gitea.io? If that, please give the repository URL?

@dloez
Copy link

dloez commented Jan 2, 2022

I cannot reproduce the error on https://try.gitea.io. These are the repositories that follow the example I said.

When I click the "New pull request button" the URL for the comparison page is different. On our server gitea tries to fetch new-branch from main-repo (which doesn't exist). On try.gitea.io this is the URL: https://try.gitea.io/lopezd/main-repo/compare/master...lopezd_1:new-branch It is still pointing to main-repo, which I understand to be the expected behavior, but instead of fetching new-branch, it fetches master.
What can be causing this different behavior?

Edit: I also want to add that in our case the owner of both repositories is the same.

@dloez
Copy link

dloez commented Oct 20, 2022

Edit: I also want to add that in our case the owner of both repositories is the same.

Reproduced on https://try.gitea.io/. Repository https://try.gitea.io/lopezd/base-repo-fork. If you navigate to branch new-branch and try to create a new PR from there, you will get redirected to https://try.gitea.io/lopezd/base-repo/compare/main...new-branch and get 404 as new-branch does not exist on the repo forked from.

We modified the link of the New PR button so it uses Repository instead of BaseRepo which is actually the behaviour we were looking for but I guess that UI should handle the 404.

@lunny lunny added type/bug and removed type/enhancement An improvement of existing functionality labels Oct 20, 2022
@lunny lunny added this to the 1.17.4 milestone Oct 20, 2022
lunny added a commit that referenced this issue Oct 21, 2022
Fix #6318

Co-authored-by: zeripath <art27@cantab.net>
lunny added a commit to lunny/gitea that referenced this issue Oct 21, 2022
Fix go-gitea#6318

Co-authored-by: zeripath <art27@cantab.net>
lunny added a commit that referenced this issue Oct 21, 2022
Fix #6318, backport #21519

Co-authored-by: zeripath <art27@cantab.net>

Co-authored-by: zeripath <art27@cantab.net>
@zeripath
Copy link
Contributor

zeripath commented Oct 22, 2022

I'm really not certain that #21519 and its backport are the solution.

The main change in those PRs is drop using the short fork notation - which I don't think are going to be the problem.

Example

If you have the following repos:

owner/base

forker/forked - forked from owner/base

Then the short fork notation /owner/base/compare/branch...forker:newbranch should work equally as well as /owner/base/compare/branch...forker/forked:newbranch

What's really going on?

There are two problems I could imagine happening - neither of which are clear from the associated issue:

Reforked repos

If you have:

reforker/reforked - forked from forker/forked then the short fork notation won't work on owner/base and you'd need the full notation to create a PR from reforker/reforked to owner/base - but I don't think we'd be offering this by default.

Permission Denied to create PRs on owner/base

I think another possible problem is where the user doesn't have permission to create a PR owner/base by default then the compare link is incorrect and we should be checking if the user could have permission to create PRs on owner/base before offering the compare link to it.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants