Issue 1072: "Push Merge Commit" permission not working on refs/heads/*

812 views
Skip to first unread message

Ishan Girdhar

unread,
Jul 14, 2014, 6:21:00 AM7/14/14
to repo-d...@googlegroups.com
Hi,
     I am working on issue 1072 [1]. I am trying to execute the steps which are mentioned there to replicate the issue. But I am not getting the same error [2] which is mentioned there. I am getting below error [3].

     Also, I am not clear about step 1 [4], does it require any external repository? or any alternative is there ?

Here are the steps which I followed:

1. Create a new project in gerrit with no initial commit
2. Grant "Push Merge Commit" on the project for "refs/heads/*"
3. git push origin master

[1] http://code.google.com/p/gerrit/issues/detail?can=2&q=1072&colspec=ID%20Type%20Stars%20Milestone%20Status%20Priority%20Owner%20Summary&id=1072

[2] ! [remote rejected] master -> master (you are not allowed to upload merges)

[3] ! [remote rejected] master -> master (prohibited by Gerrit)

[4] Have an existing repository and codebase (which includes prior merges)

           Please suggest

Thanks
Ishan Girdhar

Edwin Kempin

unread,
Jul 14, 2014, 9:29:29 AM7/14/14
to Ishan Girdhar, Repo and Gerrit Discussion
2014-07-14 12:21 GMT+02:00 Ishan Girdhar <ishan...@gmail.com>:
Hi,
     I am working on issue 1072 [1]. I am trying to execute the steps which are mentioned there to replicate the issue. But I am not getting the same error [2] which is mentioned there. I am getting below error [3].

     Also, I am not clear about step 1 [4], does it require any external repository? or any alternative is there ?

Here are the steps which I followed:

1. Create a new project in gerrit with no initial commit
2. Grant "Push Merge Commit" on the project for "refs/heads/*"
3. git push origin master
Push for review instead:
  git push origin HEAD:refs/for/master
 

[1] http://code.google.com/p/gerrit/issues/detail?can=2&q=1072&colspec=ID%20Type%20Stars%20Milestone%20Status%20Priority%20Owner%20Summary&id=1072

[2] ! [remote rejected] master -> master (you are not allowed to upload merges)

[3] ! [remote rejected] master -> master (prohibited by Gerrit)

[4] Have an existing repository and codebase (which includes prior merges)

           Please suggest

Thanks
Ishan Girdhar

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ishan Girdhar

unread,
Jul 15, 2014, 4:58:29 AM7/15/14
to repo-d...@googlegroups.com, ishan...@gmail.com
Hi Edwin,

               Thanks for your response. I have tried : git push origin HEAD:refs/for/master at step 3. Then the output I got is [1].

            But this is not what I am looking for. I want to replicate the issue 1072 [2]. I want to know the steps through which i can understand this issue. As i said in my previous comment, I have tried the steps which are mentioned in the issue but i am not getting the same error.


[1] To ssh://dev@localhost:29418/p17
 * [new branch]      HEAD -> refs/for/master

[2] http://code.google.com/p/gerrit/issues/detail?can=2&q=1072&colspec=ID%20Type%20Stars%20Milestone%20Status%20Priority%20Owner%20Summary&id=1072

Saša Živkov

unread,
Jul 16, 2014, 9:58:08 AM7/16/14
to Ishan Girdhar, repo-d...@googlegroups.com
On Tue, Jul 15, 2014 at 10:58 AM, Ishan Girdhar <ishan...@gmail.com> wrote:
Hi Edwin,

               Thanks for your response. I have tried : git push origin HEAD:refs/for/master at step 3. Then the output I got is [1].

            But this is not what I am looking for. I want to replicate the issue 1072 [2]. I want to know the steps through which i can understand this issue. As i said in my previous comment, I have tried the steps which are mentioned in the issue but i am not getting the same error.

Looks like this is fixed with 7e406720eacea8d3235b34eb34fab4c6a8a15ed3 which assigns the pushMerge permission
to Registered-Users in All-Projects.

Ishan Girdhar

unread,
Jul 22, 2014, 6:44:00 AM7/22/14
to repo-d...@googlegroups.com, ishan...@gmail.com

Hi Sasa,

I am still not able to push merge commits.

Below are the steps I executed. Please suggest.

1-Create a new project without initial commit

2- Create a newgroup and add dev user to it
2-Grant "Push Merge Commit" to newgroup on the project for "refs/heads/*"
<Create a merge commit>

3- Create branchA
4-Create branchB
5- Push some commits in branchA
6- Push some commits in branchB
7- Checkout branchB
8- Create a merge commit – git merge <SHA1 of branchA tip>
<Push merge commit>

9- git push origin HEAD:refs/heads/master

Output:
......................................................................................................
git push origin HEAD:refs/heads/master
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 305 bytes, done.
Total 2 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done    
To ssh://dev@localhost:29418/p10
! [remote rejected] HEAD -> master (prohibited by Gerrit)
error: failed to push some refs to 'ssh://dev@localhost:29418/p10'

..........................................................................................................                        
Thanks
Ishan Girdhar

Ishan Girdhar

unread,
Jul 25, 2014, 9:44:26 AM7/25/14
to repo-d...@googlegroups.com, ishan...@gmail.com


Hi Sasa

I have tested direct push of a merge commit on the current master using--> git push origin HEAD:refs/heads/<branch-name> .
But for successful execution of this command I have to assign PUSH permission to the user with which I am pushing this merge commit.

For example: I tested pushing merge commit with "dev" user .
For this I created group (group1072) and added "dev" user to it and assigned
                        PUSH permission under Reference: refs/heads/* to this group then I was able to do a direct push of a merge commit.

Is this the expected way to push merge commit?
Do we need to assign separate PUSH permission to the user?

       Below are the 2 test cases showing ACL permissions assigned.         
 
case 1: I have not given PUSH permission to group1072 under refs/head/*. In this case I am not able to push merge commit. [Below screenshot case1.jpg]



case 2: I  have given PUSH permission to group1072 under refs/head/* . In this case I am able to push merge commit [Below screenshot case2.jpg]


Ishan Girdhar

unread,
Jul 28, 2014, 6:16:28 AM7/28/14
to repo-d...@googlegroups.com, ishan...@gmail.com

Hi SASA,

                   Thanks for you reply. My doubt is :

                                 Push permission and Push Merge Commit permission is assigned by default to Registered Users under Reference: refs/for/refs/*.
So why I need to assign Push permission separately under Reference: refs/heads/* ? Since Push Merge Commit seems to work with this permission (permission under Reference: refs/for/refs/*) but for Push I need to assign again separately under Reference: refs/heads/*.


                Please suggest

Thanks
Ishan Girdhar 
   

On Wednesday, July 16, 2014 7:28:08 PM UTC+5:30, zivkov wrote:

Saša Živkov

unread,
Jul 28, 2014, 11:55:29 AM7/28/14
to Ishan Girdhar, repo-d...@googlegroups.com
On Mon, Jul 28, 2014 at 12:16 PM, Ishan Girdhar <ishan...@gmail.com> wrote:

Hi SASA,

                   Thanks for you reply. My doubt is :

                                 Push permission and Push Merge Commit permission is assigned by default to Registered Users under Reference: refs/for/refs/*.
So why I need to assign Push permission separately under Reference: refs/heads/* ? Since Push Merge Commit seems to work with this permission (permission under Reference: refs/for/refs/*) but for Push I need to assign again separately under Reference: refs/heads/*.

Yes, it may be a bit unexpected but if you check the documentation [1] you will see that
the Push Merge Commit is a kind of special permission and has always to be given on refs/for/*


Alex Nelson

unread,
Jul 28, 2014, 12:17:05 PM7/28/14
to Saša Živkov, Ishan Girdhar, repo-d...@googlegroups.com
Pardon me for lurking, but my gerrithub.io admin page doesn't even have "refs/for/*".  It has "refs/*" and "refs/for/refs*".  What am I missing here?

Luca Milanesio

unread,
Jul 29, 2014, 4:00:35 AM7/29/14
to Alex Nelson, Saša Živkov, Ishan Girdhar, repo-d...@googlegroups.com
Hi Alex,
you can add all the references you want in your projects permissions page.

If is the last "Add Reference" small link at the end of the page:


HTH

Luca.

Ishan Girdhar

unread,
Jul 31, 2014, 9:06:13 AM7/31/14
to repo-d...@googlegroups.com, ishan...@gmail.com
Hi Sasa,
 
In our case we have only few people who have push merge rights compared to who have push rights.
Hence, We have assigned permissions as below:
 
1-Remove Push Merge Commit permission from Registered users under reference: refs/for/refs/*.
2-Add Push and Push Merge Commit permission for selected users under reference: refs/heads/*.
 
Now when I try to direct push merge commit with the selected user (git push origin HEAD:refs/heads/<branch-name>) I get below error -
   
error:! [remote rejected] HEAD -> <branch-name> (you are not allowed to upload merges)
 
This is basically replication of issue 1072 which we are trying to fix.
So that we can assign Push Merge permission to only selected users
instead of all Registered User group.
 
Can you please suggest what should be the correct approach to fix this issue.
 
Thanks
Ishan girdhar

Saša Živkov

unread,
Jul 31, 2014, 9:19:20 AM7/31/14
to Ishan Girdhar, repo-d...@googlegroups.com
On Thu, Jul 31, 2014 at 3:06 PM, Ishan Girdhar <ishan...@gmail.com> wrote:
Hi Sasa,
 
In our case we have only few people who have push merge rights compared to who have push rights.
Hence, We have assigned permissions as below:
 
1-Remove Push Merge Commit permission from Registered users under reference: refs/for/refs/*.
2-Add Push and Push Merge Commit permission for selected users under reference: refs/heads/*.
 
Now when I try to direct push merge commit with the selected user (git push origin HEAD:refs/heads/<branch-name>) I get below error -
   
error:! [remote rejected] HEAD -> <branch-name> (you are not allowed to upload merges)
 
This is basically replication of issue 1072 which we are trying to fix.
So that we can assign Push Merge permission to only selected users
instead of all Registered User group.
 
Can you please suggest what should be the correct approach to fix this issue.
Have you tried assigning the Push Merge Commit for the "selected users" group to the refs/for/refs/heads/* ?
The documentation [1] says:
----
The reference name connected to a Push Merge Commit entry must always be prefixed with refs/for/, for example refs/for/refs/heads/BRANCH. This applies even for an entry that complements a Push entry for refs/heads/BRANCH that allows direct pushes of non-merge commits, and the intention of the Push Merge Commit entry is to allow direct pushes of merge commits.
----

Reply all
Reply to author
Forward
0 new messages