gitea icon indicating copy to clipboard operation
gitea copied to clipboard

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

Open seepine opened this issue 1 year ago • 9 comments

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

seepine avatar Aug 21 '23 07:08 seepine

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 avatar Aug 22 '23 02:08 wolfogre

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 avatar Aug 22 '23 02:08 CaiCandong

So at least, we need to refuse the push.

lunny avatar Aug 22 '23 03:08 lunny

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

seepine avatar Aug 28 '23 03:08 seepine

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

Right

CaiCandong avatar Aug 28 '23 03:08 CaiCandong

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 avatar Aug 28 '23 08:08 seepine

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 avatar Aug 28 '23 08:08 CaiCandong

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 avatar Aug 28 '23 08:08 seepine

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 avatar May 02 '24 03:05 lunny