[PR #4716] [MERGED] Give user a link to create PR after push #17471

Closed
opened 2025-11-02 13:34:44 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/4716
Author: @JulienTant
Created: 8/15/2018
Status: Merged
Merged: 10/20/2018
Merged by: @lafriks

Base: masterHead: create-pr-after-push


📝 Commits (5)

  • 965aa2a Give user a link to create PR after push
  • 5af0426 Forks now create PR in the base repository + make sure PR creation is allowed
  • 17c233c fix code style
  • 92d2982 Merge branch 'master' into create-pr-after-push
  • d7a6db3 Merge branch 'master' into create-pr-after-push

📊 Changes

4 files changed (+197 additions, -0 deletions)

View changed files

📝 cmd/hook.go (+43 -0)
modules/private/repository.go (+68 -0)
📝 routers/private/internal.go (+2 -0)
routers/private/repository.go (+84 -0)

📄 Description

New Feature

This PR offers a link to create new pull request when we push to a branch which is not the default branch.
If a PR already exists, it just give the link to the existing PR.

Output of a push when no active PR exists:

[branch2/test be40717] test
 1 file changed, 1 deletion(-)
Counting objects: 3, done.
Writing objects: 100% (3/3), 255 bytes | 255.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote: Create a new pull request for 'branch2/test':
remote:   http://localhost:3000/test1/test/compare/master...branch2%2Ftest
remote:
To http://localhost:3000/test1/test.git
   0c5683f..be40717  branch2/test -> branch2/test

Output of a push when an active PR exists:

[branch2/test 453d638] test
 1 file changed, 1 insertion(+)
Counting objects: 3, done.
Writing objects: 100% (3/3), 255 bytes | 255.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote: Visit the existing pull request:
remote:   http://localhost:3000/test1/test/pulls/6
remote:
To http://localhost:3000/test1/test.git
   be40717..453d638  branch2/test -> branch2/test

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/4716 **Author:** [@JulienTant](https://github.com/JulienTant) **Created:** 8/15/2018 **Status:** ✅ Merged **Merged:** 10/20/2018 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `create-pr-after-push` --- ### 📝 Commits (5) - [`965aa2a`](https://github.com/go-gitea/gitea/commit/965aa2ab3ff91edd5715d40498e970885b1918c6) Give user a link to create PR after push - [`5af0426`](https://github.com/go-gitea/gitea/commit/5af042657405634e44360e48fb4e816ba9281eca) Forks now create PR in the base repository + make sure PR creation is allowed - [`17c233c`](https://github.com/go-gitea/gitea/commit/17c233c0346f959077f834685c3e370078592055) fix code style - [`92d2982`](https://github.com/go-gitea/gitea/commit/92d2982f1dedfc34b466b3d66473d88a5ab84309) Merge branch 'master' into create-pr-after-push - [`d7a6db3`](https://github.com/go-gitea/gitea/commit/d7a6db35051c1bd5dabde2a5ccb0b6b589325cdf) Merge branch 'master' into create-pr-after-push ### 📊 Changes **4 files changed** (+197 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/hook.go` (+43 -0) ➕ `modules/private/repository.go` (+68 -0) 📝 `routers/private/internal.go` (+2 -0) ➕ `routers/private/repository.go` (+84 -0) </details> ### 📄 Description ## New Feature This PR offers a link to create new pull request when we push to a branch which is not the default branch. If a PR already exists, it just give the link to the existing PR. ### Output of a push when no active PR exists: ``` [branch2/test be40717] test 1 file changed, 1 deletion(-) Counting objects: 3, done. Writing objects: 100% (3/3), 255 bytes | 255.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: Create a new pull request for 'branch2/test': remote: http://localhost:3000/test1/test/compare/master...branch2%2Ftest remote: To http://localhost:3000/test1/test.git 0c5683f..be40717 branch2/test -> branch2/test ``` ### Output of a push when an active PR exists: ``` [branch2/test 453d638] test 1 file changed, 1 insertion(+) Counting objects: 3, done. Writing objects: 100% (3/3), 255 bytes | 255.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: Visit the existing pull request: remote: http://localhost:3000/test1/test/pulls/6 remote: To http://localhost:3000/test1/test.git be40717..453d638 branch2/test -> branch2/test ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 13:34:44 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17471