Re: How to handle pull request with git?
On 4/15/21 1:24 PM, Mark Wielaard wrote: On Wed, Apr 14, 2021 at 04:04:21PM +0200, Robert-André Mauchin wrote: On 4/14/21 3:28 PM, Mark Wielaard wrote: I got a "pull request" for one of my packages and wanted to make some changes to discuss with the submitter and see if we could merge it back with those changes to the rawhide branch. But somehow I did something wrong and I am not sure what or how to fix it. So I saw this webpage with the suggested change: https://src.fedoraproject.org/rpms/valgrind/pull-request/4 I added the following line to my .git/config at the end of the [remote "origin"] section to be able to pull it: fetch = +refs/pull/*/head:refs/remotes/origin/pr/* Then git pulled and checkout pr/4, made the changes, committed them and pushed them back, hoping that would update the pr. But it didn't, apparently I created a new origin/pr/4 branch, which I am now unable to delete because: $ git push origin --delete pr/4 remote: Branch deletion is not allowed remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw' remote: All changes have been rejected To ssh://pkgs.fedoraproject.org/rpms/valgrind ! [remote rejected] pr/4 (pre-receive hook declined) error: failed to push some refs to 'ssh://pkgs.fedoraproject.org/rpms/valgrind' What did I do wrong and how do I fix this? 1. You clone the forked repository 2. You checkout the branch where the modification has been made 3. You edit the files you want to change 4. You commit (or amend) the new changes 5. You push (or force push) the commit 6. Your commit will appear in the Pull Request ar "Rebased blah blah" 7. Merge your changes Thanks. So I believed I was doing the above, but apparently not. Would you mind explaining steps 1, 2 and 5 a bit more. So what I did to clone the prs was to add that extra fetch line in my .git/config. Which seemed to allow me to pull and work on the branch remote pull/4 as pr/4 locally. Then I though I pushed it back, but apparently that created a new branch in the origin called pr/4 instead of getting my changes back into the remote pull/4. Apparently the fetch line doesn't work like I expected. Thanks, Mark So you have this PR: https://src.fedoraproject.org/rpms/valgrind/pull-request/4 - You see it is coming from rpms/ahajkova/valgrind So you go to https://src.fedoraproject.org/fork/ahajkova/rpms/valgrind/tree/rawhide (by clicking on the first "rawhide") - and get the clone url and clone that repository: git clone ssh://m...@pkgs.fedoraproject.org/forks/ahajkova/rpms/valgrind.git - You checkout the branch where the changes have been made. Here it's already rawhide so you don't need to change. - Here you might need to rebase: git remote add upstream ssh://m...@pkgs.fedoraproject.org/rpms/valgrind.git git fetch upstream git rebase upstream/rawhide (Fix the eventual conflicts) - Then make the PR changes you want - Commit the changes by amending the previous commit - git push --force to force the edit of the commit to the remote It will update your PR directly. ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Re: How to handle pull request with git?
On Wed, Apr 14, 2021 at 04:04:21PM +0200, Robert-André Mauchin wrote: > On 4/14/21 3:28 PM, Mark Wielaard wrote: > > I got a "pull request" for one of my packages and wanted to make some > > changes to discuss with the submitter and see if we could merge it > > back with those changes to the rawhide branch. But somehow I did > > something wrong and I am not sure what or how to fix it. > > > > So I saw this webpage with the suggested change: > > https://src.fedoraproject.org/rpms/valgrind/pull-request/4 > > > > I added the following line to my .git/config at the end of the [remote > > "origin"] section to be able to pull it: > > > > fetch = +refs/pull/*/head:refs/remotes/origin/pr/* > > > > Then git pulled and checkout pr/4, made the changes, committed them > > and pushed them back, hoping that would update the pr. > > > > But it didn't, apparently I created a new origin/pr/4 branch, which I > > am now unable to delete because: > > > > $ git push origin --delete pr/4 > > remote: Branch deletion is not allowed > > remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw' > > remote: All changes have been rejected > > To ssh://pkgs.fedoraproject.org/rpms/valgrind > > ! [remote rejected] pr/4 (pre-receive hook declined) > > error: failed to push some refs to > > 'ssh://pkgs.fedoraproject.org/rpms/valgrind' > > > > What did I do wrong and how do I fix this? > > > > 1. You clone the forked repository > 2. You checkout the branch where the modification has been made > 3. You edit the files you want to change > 4. You commit (or amend) the new changes > 5. You push (or force push) the commit > 6. Your commit will appear in the Pull Request ar "Rebased blah blah" > 7. Merge your changes Thanks. So I believed I was doing the above, but apparently not. Would you mind explaining steps 1, 2 and 5 a bit more. So what I did to clone the prs was to add that extra fetch line in my .git/config. Which seemed to allow me to pull and work on the branch remote pull/4 as pr/4 locally. Then I though I pushed it back, but apparently that created a new branch in the origin called pr/4 instead of getting my changes back into the remote pull/4. Apparently the fetch line doesn't work like I expected. Thanks, Mark ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Re: How to handle pull request with git?
On Wed, Apr 14, 2021 at 02:38:40PM +0100, Tom Hughes via devel wrote: > On 14/04/2021 14:28, Mark Wielaard wrote: > > > I added the following line to my .git/config at the end of the [remote > > "origin"] section to be able to pull it: > > > > fetch = +refs/pull/*/head:refs/remotes/origin/pr/* > > > > Then git pulled and checkout pr/4, made the changes, committed them > > and pushed them back, hoping that would update the pr. > > Is there anywhere that works? > > I don't think even github allows you to push back to the > generated head for the PR like that. If the person who opened > the PR allowed it then you can push to their original branch > to update the PR - no idea if pagure supports that. I have no experience with github, but it looked like a normal remote branch to me, so I expected to be able to push to it. How else are you supposed to coordinate on a PR/patch like that? > Possibly src.fpo should reject pushes to the PR heads to > avoid this kind of accident though. Yes, I did certainly mess up here, don't completely understand how, but it would have been nice if the system would have stopped me. > > But it didn't, apparently I created a new origin/pr/4 branch, which I > > am now unable to delete because: > > > > $ git push origin --delete pr/4 > > remote: Branch deletion is not allowed > > remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw' > > remote: All changes have been rejected > > To ssh://pkgs.fedoraproject.org/rpms/valgrind > > ! [remote rejected] pr/4 (pre-receive hook declined) > > error: failed to push some refs to > > 'ssh://pkgs.fedoraproject.org/rpms/valgrind' > > > > What did I do wrong and how do I fix this? > > You pushed a branch into source git which is bad as hey > can't be deleted. > > I believe in principle you can ask an admin to delete it > so long as no builds have been done from it. That would be nice. How do I contact an admin? Thanks, Mark ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Re: How to handle pull request with git?
On 4/14/21 3:28 PM, Mark Wielaard wrote: Hi, I got a "pull request" for one of my packages and wanted to make some changes to discuss with the submitter and see if we could merge it back with those changes to the rawhide branch. But somehow I did something wrong and I am not sure what or how to fix it. So I saw this webpage with the suggested change: https://src.fedoraproject.org/rpms/valgrind/pull-request/4 I added the following line to my .git/config at the end of the [remote "origin"] section to be able to pull it: fetch = +refs/pull/*/head:refs/remotes/origin/pr/* Then git pulled and checkout pr/4, made the changes, committed them and pushed them back, hoping that would update the pr. But it didn't, apparently I created a new origin/pr/4 branch, which I am now unable to delete because: $ git push origin --delete pr/4 remote: Branch deletion is not allowed remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw' remote: All changes have been rejected To ssh://pkgs.fedoraproject.org/rpms/valgrind ! [remote rejected] pr/4 (pre-receive hook declined) error: failed to push some refs to 'ssh://pkgs.fedoraproject.org/rpms/valgrind' What did I do wrong and how do I fix this? Thanks, Mark 1. You clone the forked repository 2. You checkout the branch where the modification has been made 3. You edit the files you want to change 4. You commit (or amend) the new changes 5. You push (or force push) the commit 6. Your commit will appear in the Pull Request ar "Rebased blah blah" 7. Merge your changes ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
Re: How to handle pull request with git?
On 14/04/2021 14:28, Mark Wielaard wrote: I added the following line to my .git/config at the end of the [remote "origin"] section to be able to pull it: fetch = +refs/pull/*/head:refs/remotes/origin/pr/* Then git pulled and checkout pr/4, made the changes, committed them and pushed them back, hoping that would update the pr. Is there anywhere that works? I don't think even github allows you to push back to the generated head for the PR like that. If the person who opened the PR allowed it then you can push to their original branch to update the PR - no idea if pagure supports that. Possibly src.fpo should reject pushes to the PR heads to avoid this kind of accident though. But it didn't, apparently I created a new origin/pr/4 branch, which I am now unable to delete because: $ git push origin --delete pr/4 remote: Branch deletion is not allowed remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw' remote: All changes have been rejected To ssh://pkgs.fedoraproject.org/rpms/valgrind ! [remote rejected] pr/4 (pre-receive hook declined) error: failed to push some refs to 'ssh://pkgs.fedoraproject.org/rpms/valgrind' What did I do wrong and how do I fix this? You pushed a branch into source git which is bad as hey can't be deleted. I believe in principle you can ask an admin to delete it so long as no builds have been done from it. Tom -- Tom Hughes (t...@compton.nu) http://compton.nu/ ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
How to handle pull request with git?
Hi, I got a "pull request" for one of my packages and wanted to make some changes to discuss with the submitter and see if we could merge it back with those changes to the rawhide branch. But somehow I did something wrong and I am not sure what or how to fix it. So I saw this webpage with the suggested change: https://src.fedoraproject.org/rpms/valgrind/pull-request/4 I added the following line to my .git/config at the end of the [remote "origin"] section to be able to pull it: fetch = +refs/pull/*/head:refs/remotes/origin/pr/* Then git pulled and checkout pr/4, made the changes, committed them and pushed them back, hoping that would update the pr. But it didn't, apparently I created a new origin/pr/4 branch, which I am now unable to delete because: $ git push origin --delete pr/4 remote: Branch deletion is not allowed remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw' remote: All changes have been rejected To ssh://pkgs.fedoraproject.org/rpms/valgrind ! [remote rejected] pr/4 (pre-receive hook declined) error: failed to push some refs to 'ssh://pkgs.fedoraproject.org/rpms/valgrind' What did I do wrong and how do I fix this? Thanks, Mark ___ devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure