Pull Request button doesn't reflect selected branch for fork #93

Closed
opened 2025-11-02 03:08:30 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @rbukovansky on GitHub (Nov 29, 2016).

  • Gitea version (or commit ref): 42ec5ce740
  • Git version: 1.8.3.1
  • Operating system: CentOS 7.2
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite
  • Log gist:

Description

  1. Make Fork->Clone->Branch->Push cycle, so you end up with new branch pushed to your remote repository
  2. Open your Gitea and go to your fork
  3. Select pushed branch
  4. Click on Pull Request button.

Gitea doesn't reflect selected branch in link of the PR button, so it always tries to create PR for i.e. <upstream>:master...<fork>:master, instead of <upstream>:master...<fork>:<pushed_and_selected_branch>. So I need then to change the branch for my fork after I click the PR button, which I find annoying as I have already selected the branch I want to have that PR from.

Please, correct it. Thanks.

Same issue as https://github.com/gogits/gogs/issues/3604

Originally created by @rbukovansky on GitHub (Nov 29, 2016). - Gitea version (or commit ref): 42ec5ce740fd - Git version: 1.8.3.1 - Operating system: CentOS 7.2 - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] SQLite - Log gist: ## Description 1. Make Fork->Clone->Branch->Push cycle, so you end up with new branch pushed to your remote repository 2. Open your Gitea and go to your fork 3. Select pushed branch 4. Click on Pull Request button. Gitea doesn't reflect selected branch in link of the PR button, so it always tries to create PR for i.e. `<upstream>:master...<fork>:master`, instead of `<upstream>:master...<fork>:<pushed_and_selected_branch>`. So I need then to change the branch for my fork after I click the PR button, which I find annoying as I have already selected the branch I want to have that PR from. Please, correct it. Thanks. Same issue as https://github.com/gogits/gogs/issues/3604
GiteaMirror added the topic/uitype/bug labels 2025-11-02 03:08:30 -06:00
Author
Owner

@bkcsoft commented on GitHub (Dec 2, 2016):

this should be a simple matter of changing from .Repo.DefaultBranch to ctx.Repo.CurrentBranch (or something similar)

@bkcsoft commented on GitHub (Dec 2, 2016): this should be a simple matter of changing from `.Repo.DefaultBranch` to `ctx.Repo.CurrentBranch` (or something similar)
Author
Owner

@lunny commented on GitHub (Dec 2, 2016):

@bkcsoft, send a PR?

@lunny commented on GitHub (Dec 2, 2016): @bkcsoft, send a PR?
Author
Owner

@rbukovansky commented on GitHub (Dec 2, 2016):

I've got some workaround for this changing one line in templates/repo/home.tmpl from this:

<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.PullRequestCtx.HeadInfo}}">

to this:

<a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.Owner.Name}}:{{.BranchName}}">

but investigating further it seems to me that this line:

ctx.Repo.PullRequest.HeadInfo = ctx.Repo.Owner.Name + ":" + ctx.Repo.BranchName

in modules/context/repo.go is not working properly.

But I'm not Go guy, so I can't debug it by myself.

@rbukovansky commented on GitHub (Dec 2, 2016): I've got some workaround for this changing one line in `templates/repo/home.tmpl` from this: ```html <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.PullRequestCtx.HeadInfo}}"> ``` to this: ```html <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.Owner.Name}}:{{.BranchName}}"> ``` but investigating further it seems to me that this line: ```go ctx.Repo.PullRequest.HeadInfo = ctx.Repo.Owner.Name + ":" + ctx.Repo.BranchName ``` in modules/context/repo.go is not working properly. But I'm not Go guy, so I can't debug it by myself.
Author
Owner

@lunny commented on GitHub (Jan 26, 2017):

closed by #762

@lunny commented on GitHub (Jan 26, 2017): closed by #762
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#93