The direct modification on the PR causes the loss of the derived information. #11496

Open
opened 2025-11-02 09:39:19 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @seepine on GitHub (Aug 21, 2023).

Description

The up repo https://example.com/a/crm, and Bob fork it https://example.com/bob/crm, he commit something and create pull request for PR#59 https://example.com/a/crm/pulls/59

I review it

git fetch up pull/59/head:pr59
git checkout pr59

And fix something

git commit -m 'fix some bug'

Then push to PR#59

git push up pr57:pull/57/head

I can find my commit in https://example.com/a/crm/pulls/59/commits, But can not merge this pr,
the error message This pull request is broken due to missing fork information..

image

Gitea Version

1.20.2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

2.39.2

Operating System

MacOS 13.4

How are you running Gitea?

run in docker

Database

MySQL

Originally created by @seepine on GitHub (Aug 21, 2023). ### Description The up repo `https://example.com/a/crm`, and Bob fork it `https://example.com/bob/crm`, he commit something and create pull request for PR#59 `https://example.com/a/crm/pulls/59` I review it ```bash git fetch up pull/59/head:pr59 git checkout pr59 ``` And fix something ```bash git commit -m 'fix some bug' ``` Then push to PR#59 ```bash git push up pr57:pull/57/head ``` I can find my commit in `https://example.com/a/crm/pulls/59/commits`, But can not merge this pr, the error message `This pull request is broken due to missing fork information.`. ![image](https://github.com/go-gitea/gitea/assets/93666053/f249f536-f54e-4f88-a541-b2a92e63db5e) ### Gitea Version 1.20.2 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.39.2 ### Operating System MacOS 13.4 ### How are you running Gitea? run in docker ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 09:39:19 -06:00
Author
Owner

@wolfogre commented on GitHub (Aug 22, 2023):

And fix something

git commit -m 'fix some bug'

Then push to PR#59

git push up pr57:pull/57/head

Wait, you shouldn't do this, pull/57/head is a branch to track the head branch of the PR, you should push to Bob's branch.

My question: does GitHub support pushing to pull/*/head?

@wolfogre commented on GitHub (Aug 22, 2023): > And fix something > ```bash > git commit -m 'fix some bug' > ``` > Then push to PR#59 > ```bash > git push up pr57:pull/57/head > ``` Wait, you shouldn't do this, `pull/57/head` is a branch to track the head branch of the PR, you should push to Bob's branch. My question: does GitHub support pushing to `pull/*/head`?
Author
Owner

@CaiCandong commented on GitHub (Aug 22, 2023):

I repeated the steps you provided above on github:

  • git push origin pr1:pull/1/head
    image
    but it creates a new branch rather than modifying the pull/1
    image

  • git push origin pr1:refs/pull/1/head
    When I made it clear that I wanted to change pull/1, github rejected my push
    image

@CaiCandong commented on GitHub (Aug 22, 2023): I repeated the steps you provided above on github: - `git push origin pr1:pull/1/head` ![image](https://github.com/go-gitea/gitea/assets/50507092/e9c9bbbb-4d7a-4673-a969-a8ee0bf89486) but it creates a new branch rather than modifying the `pull/1` ![image](https://github.com/go-gitea/gitea/assets/50507092/7da6ff2c-4185-4ef1-af33-cb78645fb34a) - `git push origin pr1:refs/pull/1/head` When I made it clear that I wanted to change `pull/1`, github rejected my push ![image](https://github.com/go-gitea/gitea/assets/50507092/2ef91b45-0d9c-4e41-84bc-74ec1ce22b1c)
Author
Owner

@lunny commented on GitHub (Aug 22, 2023):

So at least, we need to refuse the push.

@lunny commented on GitHub (Aug 22, 2023): So at least, we need to refuse the push.
Author
Owner

@seepine commented on GitHub (Aug 28, 2023):

So i need to git remote add bob https://example.com/bob/crm, and git push to bob dev branch?

@seepine commented on GitHub (Aug 28, 2023): So i need to `git remote add bob https://example.com/bob/crm`, and git push to bob dev branch?
Author
Owner

@CaiCandong commented on GitHub (Aug 28, 2023):

So i need to git remote add bob https://example.com/bob/crm, and git push to bob dev branch?

Right

@CaiCandong commented on GitHub (Aug 28, 2023): > So i need to `git remote add bob https://example.com/bob/crm`, and git push to bob dev branch? Right
Author
Owner

@seepine commented on GitHub (Aug 28, 2023):

So i need to git remote add bob https://example.com/bob/crm, and git push to bob dev branch?

Right

Bob create pull request a/crm:main from bob/crm:dev1
When i try

$ git fetch up pull/119/head:dev1
$ git checkout dev1
$ git remote add bob https://example.com/bob/crm.git

and

$ git push bob dev1
remote: Repository not found
fatal: repository 'https://example.com/bob/crm.git/' not found

I am sure checked Allow edits from maintainers by default and can see Update branch by merge button in pulls#119.

@seepine commented on GitHub (Aug 28, 2023): > > So i need to `git remote add bob https://example.com/bob/crm`, and git push to bob dev branch? > > Right Bob create pull request `a/crm:main` from `bob/crm:dev1` When i try ```sh $ git fetch up pull/119/head:dev1 $ git checkout dev1 $ git remote add bob https://example.com/bob/crm.git ``` and ```sh $ git push bob dev1 remote: Repository not found fatal: repository 'https://example.com/bob/crm.git/' not found ``` I am sure checked `Allow edits from maintainers by default` and can see `Update branch by merge` button in pulls#119.
Author
Owner

@CaiCandong commented on GitHub (Aug 28, 2023):

git remote add bob https://example.com/bob/crm.git
git fetch bob dev1
git checkout dev1
fix & add &commit 
git push bob  dev1

Work directly on the bob's repo, not the up.

@CaiCandong commented on GitHub (Aug 28, 2023): ``` git remote add bob https://example.com/bob/crm.git git fetch bob dev1 git checkout dev1 fix & add &commit git push bob dev1 ``` Work directly on the bob's repo, not the `up`.
Author
Owner

@seepine commented on GitHub (Aug 28, 2023):

git remote add bob https://example.com/bob/crm.git
git fetch bob dev1
git checkout dev1
fix & add &commit 
git push bob  dev1

Work directly on the bob's repo, not the up.

I got the same error

$ git fetch bob dev1
remote: Repository not found
fatal: repository 'https://example.com/bob/crm.git/' not found
$ git remote -v
up    https://example.com/a/crm.git (fetch)
up    https://example.com/a/crm.git (push)
bob     https://example.com/bob/crm.git (fetch)
bob     https://example.com/bob/crm.git (push)

The issue is that after allowing maintainers to edit is checked on GitHub, it will automatically add the maintainers as collaborators to Bob's repository, so the maintainers have permissions.
But on Gitea, Bob needs to manually add collaborators to his own forked repository, otherwise even though Bob has checked "Allow maintainers to edit", the maintainers won't have permission to modify the PR branch despite that.

@seepine commented on GitHub (Aug 28, 2023): > ``` > git remote add bob https://example.com/bob/crm.git > git fetch bob dev1 > git checkout dev1 > fix & add &commit > git push bob dev1 > ``` > > Work directly on the bob's repo, not the `up`. I got the same error ``` $ git fetch bob dev1 remote: Repository not found fatal: repository 'https://example.com/bob/crm.git/' not found ``` ``` $ git remote -v up https://example.com/a/crm.git (fetch) up https://example.com/a/crm.git (push) bob https://example.com/bob/crm.git (fetch) bob https://example.com/bob/crm.git (push) ``` The issue is that after allowing maintainers to edit is checked on GitHub, it will automatically add the maintainers as collaborators to Bob's repository, so the maintainers have permissions. But on Gitea, Bob needs to manually add collaborators to his own forked repository, otherwise even though Bob has checked "Allow maintainers to edit", the maintainers won't have permission to modify the PR branch despite that.
Author
Owner

@lunny commented on GitHub (May 2, 2024):

The direct push to git push pr57:pull/57/head should be deny from Gitea side. It should be only changed by Gitea itself.

@lunny commented on GitHub (May 2, 2024): The direct push to `git push pr57:pull/57/head` should be deny from Gitea side. It should be only changed by Gitea itself.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#11496