Support pull requests on mirror repositories. #4933

Open
opened 2025-11-02 06:08:04 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @lunny on GitHub (Feb 25, 2020).

Currently, a mirror repoisitory could not merge anything, but we could still allow pull requests and don't allow to merge them.

Originally created by @lunny on GitHub (Feb 25, 2020). Currently, a mirror repoisitory could not merge anything, but we could still allow pull requests and don't allow to merge them.
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 06:08:04 -06:00
Author
Owner

@stale[bot] commented on GitHub (Jun 22, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Jun 22, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@davydov-vyacheslav commented on GitHub (Jun 23, 2020):

Ping?

@davydov-vyacheslav commented on GitHub (Jun 23, 2020): Ping?
Author
Owner

@thigg commented on GitHub (Jul 6, 2021):

Is there a reason why this was postponed? That would be a very useful feature for teams that want to try out gitea

@thigg commented on GitHub (Jul 6, 2021): Is there a reason why this was postponed? That would be a very useful feature for teams that want to try out gitea
Author
Owner

@thigg commented on GitHub (Jul 6, 2021):

Just for the ones who are interested:
I tried with this patch on the current release and the basic functionality seems to be working.

So the remaining step would be to disable the merge button and add a hint maybe.

diff --git a/models/repo.go b/models/repo.go
index 009e7a457..d60487316 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -810,7 +810,7 @@ func (repo *Repository) CanUserDelete(user *User) (bool, error) {

 // CanEnablePulls returns true if repository meets the requirements of accepting pulls.
 func (repo *Repository) CanEnablePulls() bool {
-       return !repo.IsMirror && !repo.IsEmpty
+       return !repo.IsEmpty
 }

 // AllowsPulls returns true if repository meets the requirements of accepting pulls and has them enabled.
@thigg commented on GitHub (Jul 6, 2021): Just for the ones who are interested: I tried with this patch on the current release and the basic functionality seems to be working. So the remaining step would be to disable the merge button and add a hint maybe. ```diff diff --git a/models/repo.go b/models/repo.go index 009e7a457..d60487316 100644 --- a/models/repo.go +++ b/models/repo.go @@ -810,7 +810,7 @@ func (repo *Repository) CanUserDelete(user *User) (bool, error) { // CanEnablePulls returns true if repository meets the requirements of accepting pulls. func (repo *Repository) CanEnablePulls() bool { - return !repo.IsMirror && !repo.IsEmpty + return !repo.IsEmpty } // AllowsPulls returns true if repository meets the requirements of accepting pulls and has them enabled. ```
Author
Owner

@thigg commented on GitHub (Jul 29, 2021):

@lunny

Would you prefer adding a check around here and another check for disabling the button.

Or disabling the mergeconfig and setting false as default?

We're thinking about migrating to gitea, but have some repos hosted elsewhere (e.g. at customers). Thus doing code-reviews etc with gitea would be nice, even if the repo is mirrored.

@thigg commented on GitHub (Jul 29, 2021): @lunny Would you prefer adding a check around [here](https://github.com/go-gitea/gitea/blob/main/routers/web/repo/pull.go#L803) and another check for disabling the button. Or disabling the [mergeconfig](https://github.com/go-gitea/gitea/blob/9f31f3aa8ac4f6bfc8390c9ae63b2a387b414c88/models/repo_unit.go#L89) and setting false as default? We're thinking about migrating to gitea, but have some repos hosted elsewhere (e.g. at customers). Thus doing code-reviews etc with gitea would be nice, even if the repo is mirrored.
Author
Owner

@lunny commented on GitHub (Jul 29, 2021):

Since #15157 merged, I think this is possible for push mirror repositories. But for pull mirror repositories, it maybe conflicted with in future feature which is mirror remote pull quests into local repositories.

@lunny commented on GitHub (Jul 29, 2021): Since #15157 merged, I think this is possible for push mirror repositories. But for pull mirror repositories, it maybe conflicted with in future feature which is mirror remote pull quests into local repositories.
Author
Owner

@thigg commented on GitHub (Aug 24, 2021):

@lunny you suppose to enable pull request on push mirrors then?

@thigg commented on GitHub (Aug 24, 2021): @lunny you suppose to enable pull request on push mirrors then?
Author
Owner

@lunny commented on GitHub (Aug 24, 2021):

Please send a PR to do that.

@lunny commented on GitHub (Aug 24, 2021): Please send a PR to do that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4933