Gerrit merge issue

162 views
Skip to first unread message

Irfan Sayed

unread,
Nov 24, 2015, 3:51:16 AM11/24/15
to Repo and Gerrit Discussion
Hi,

I have created git gerrit flow and able to create basic code review process. 
however, when the code review happens, and when i say submit, assumption is , changes will be merged to git repo and the same is being shown as history comment also.
but the issue is , changes are not really merged to git repo 

I have to manually run this command : "git push origin master" to upload the changes... 
i am not getting what is the issue. is there any configuration issue which can be looked at ?
i am using gerrit version : 2.9.2

please suggest . I am stuck totally 

Regards,
irfan

Robert Mitwicki

unread,
Nov 24, 2015, 4:39:35 AM11/24/15
to Repo and Gerrit Discussion


I have created git gerrit flow and able to create basic code review process. 
however, when the code review happens, and when i say submit, assumption is , changes will be merged to git repo and the same is being shown as history comment also.
but the issue is , changes are not really merged to git repo 


When you will press submit button on gerrit, the change will be merge into the branch where it was reviewed.
So if you have new commit and you push it to gerrit:

    git push origin HEAD:refs/for/master

You will get new change set on gerrit for review
When you will submit it (press submit button on gerrit)
It will be merge into master. It can happen that it will not be possible to merge it due to conflicts.
But then gerrit will inform you about that and on the screen you should see information that the change cannot be merge.

 
I have to manually run this command : "git push origin master" to upload the changes... 
i am not getting what is the issue. is there any configuration issue which can be looked at ?
i am using gerrit version : 2.9.2

What happen when you press submit button on gerrit? What is the status of the change which you trying to submit?

Irfan Sayed

unread,
Nov 24, 2015, 12:43:42 PM11/24/15
to Repo and Gerrit Discussion
Thanks.

when i press the submit button on gerrit, gerrit says following 
Change has been successfully merged into the git repository.

above message clearly mentions that, changes are merged to git repo.
But after that , when i execute command "git push origin master" then some changes gets merged to git repo and those changes are nothing but changes which are reviewed in gerrit.
my understanding is "git push origin master" command should say "everything is up to date" and that would have happened if gerrit would have merged the changes after pressing the submit button. but that is not the reality 

please suggest 

Regards
Irfan

Irfan Sayed

unread,
Nov 24, 2015, 11:18:37 PM11/24/15
to Repo and Gerrit Discussion
Please suggest.. I am stuck on this 

Regards
Irfan

Robert Mitwicki

unread,
Nov 25, 2015, 1:33:08 AM11/25/15
to Repo and Gerrit Discussion

On Tuesday, November 24, 2015 at 2:21:16 PM UTC+5:30, Irfan Sayed wrote:
Hi,

I have created git gerrit flow and able to create basic code review process. 
however, when the code review happens, and when i say submit, assumption is , changes will be merged to git repo and the same is being shown as history comment also.
but the issue is , changes are not really merged to git repo 

I have to manually run this command : "git push origin master" to upload the changes... 
i am not getting what is the issue. is there any configuration issue which can be looked at ?
i am using gerrit version : 2.9.2


Is hard to suggest anything without possibility to recreate that issue. Are you able to share access to that gerrit?
This what I would suggest to do the fallow test:

Make sure that your branch is up to date:

     git pull origin master

Then do some changes


     git push origin HEAD:refs/for/master

Review it and submit, then do again:

    git pull origin master

If nobody will push in meanwhile anything to repo and the submit will be submited without merge (btw. what kind of strategy do you have for that project -> Project -> General -> Submit Type because maybe that the issue)
Then this should say everything up-to-date

If not check the commit sha and see why it change. For example if you will have submit type set to always merge it will generate always merge commit.


Hope that will help you sort out what is going on.
Best regards
Robert

Irfan Sayed

unread,
Nov 25, 2015, 3:16:09 AM11/25/15
to Robert Mitwicki, Repo and Gerrit Discussion
Thanks. what do you mean by "Are you able to share access to that gerrit?"
Let me explain step by step:

1: git pull origin master
this will pull the latest code from git repo.

2: git checkout run.sh
checkout run.sh

3: made some changes

4: git commit -m "first commit" run.sh

5: git push ssh://ad...@192.168.102.34:29418/aTechnologies HEAD:refs/for/master
pushing changes to gerrit for code review
this will create the patchset
 

6: login to gerrit server and do the code review. once done click on submit 
this creates the commit message in the history that : 
Change has been successfully merged into the git repository

after this, when i execute: "git push origin master" then changes are getting merged to git repo

i am not sure how to check commit sha and submit type set to always merge 

please suggest 

regards

   

--
--
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 a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/EUEs28CAkng/unsubscribe.
To unsubscribe from this group and all its topics, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Pursehouse

unread,
Nov 25, 2015, 3:19:17 AM11/25/15
to Irfan Sayed, Robert Mitwicki, Repo and Gerrit Discussion
On 11/25/2015 05:16 PM, Irfan Sayed wrote:
> Thanks. what do you mean by "Are you able to share access to that gerrit?"
> Let me explain step by step:
>
> 1: git pull origin master
> this will pull the latest code from git repo.
>
> 2: git checkout run.sh
> checkout run.sh
>
> 3: made some changes
>
> 4: git commit -m "first commit" run.sh
>
> 5: git push ssh://ad...@192.168.102.34:29418/aTechnologies
> <http://ad...@192.168.102.34:29418/aTechnologies> HEAD:refs/for/master
> pushing changes to gerrit for code review
> this will create the patchset
>
>
> 6: login to gerrit server and do the code review. once done click on submit
> this creates the commit message in the history that :
> Change has been successfully merged into the git repository
>

What happens if you do "git fetch" here?
> <mailto:repo-discuss%2Bunsu...@googlegroups.com>
> More info at http://groups.google.com/group/repo-discuss?hl=en
>
> ---
> You received this message because you are subscribed to a topic in
> the Google Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/repo-discuss/EUEs28CAkng/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> repo-discuss...@googlegroups.com
> <mailto:repo-discuss...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> 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
> <mailto:repo-discuss...@googlegroups.com>.

Irfan Sayed

unread,
Nov 25, 2015, 3:42:08 AM11/25/15
to David Pursehouse, Robert Mitwicki, Repo and Gerrit Discussion
thanks.
nothing happens when i do "git fetch" . there is no output on console

but if i do "git push origin master" then following is the output:

[admin@workstation1 aTechnologies]$ git push origin master
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 336 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
   b6e55e0..933cfeb  master -> master
[admin@workstation1 aTechnologies]$

Regards

Björn Pedersen

unread,
Nov 25, 2015, 3:58:46 AM11/25/15
to Repo and Gerrit Discussion, mit...@gmail.com


Am Mittwoch, 25. November 2015 09:16:09 UTC+1 schrieb Irfan Sayed:
Thanks. what do you mean by "Are you able to share access to that gerrit?"
Let me explain step by step:

1: git pull origin master
this will pull the latest code from git repo

This seems OK on first sight. But how is master configured?
 
2: git checkout run.sh
checkout run.sh

This is possibly not really doing what you think it is. It is trying to check out an existing local branch named 'run.sh'

 
3: made some changes

4: git commit -m "first commit" run.sh

5: git push ssh://ad...@192.168.102.34:29418/aTechnologies HEAD:refs/for/master
pushing changes to gerrit for code review
this will create the patchset
 

This colud be an indiction where the trouble starts. Is this the same repo as origin? Or is this  a different server? If yes, then probably replication is not configured/working or the replication delay is long.
 

6: login to gerrit server and do the code review. once done click on submit 
this creates the commit message in the history that : 
Change has been successfully merged into the git repository

If origin is not your gerrit server, this would happen if the changes are not replicated correctly.
 
after this, when i execute: "git push origin master" then changes are getting merged to git repo


Björn

Robert Mitwicki

unread,
Nov 25, 2015, 4:53:56 AM11/25/15
to Repo and Gerrit Discussion, mit...@gmail.com


W dniu środa, 25 listopada 2015 09:16:09 UTC+1 użytkownik Irfan Sayed napisał:
Thanks. what do you mean by "Are you able to share access to that gerrit?"

That you could give the link to gerrit so I could take a look on the configuration.
And try to reproduce the error. Since I am pretty sure that you are doing something wrong but hard to guess what.
 

2: git checkout run.sh
checkout run.sh

Why you are doing that? You already have latest code by pulling it from the server. What do you want to achieve by that?
 

6: login to gerrit server and do the code review. once done click on submit 
this creates the commit message in the history that : 
Change has been successfully merged into the git repository

after this, when i execute: "git push origin master" then changes are getting merged to git repo

In first place why you are doing that? Why you want to push anything to repo? You should try to git pull origin master to see if you have up-to-date changes.
Even if you have good reason why you do that (which I doubt) it will be helpful if you will show us the output of that command because probably you see something like this:
Total 0 (delta 0), reused 0 (delta 0)
remote: Processing changes: closed: 2, refs: 1, done
To ssh://user@localhost:29418/repo
bedbee..9411bfc master -> master

Which means that nothing change (look on the first line)


 

i am not sure how to check commit sha and submit type set to always merge 

you can simple read the sha from the change patch which you have in gerrit (is below commit message)
or use git log --oneline to see what commits do you have before pushing and after.

Best regards
Robert

Irfan Sayed

unread,
Nov 25, 2015, 5:06:24 AM11/25/15
to Robert Mitwicki, Repo and Gerrit Discussion
Thanks.
I revisited the entire setup again. actually, the git repo is mirrored on the gerrit server and actual git repo is there on the git server (which is another VM)
so whenever i am pressing submit button then changes are going to this mirrored repo and not to the actual repo (which is there on the git server )???

regards


--

Irfan Sayed

unread,
Nov 26, 2015, 4:18:04 AM11/26/15
to Robert Mitwicki, Repo and Gerrit Discussion
please suggest. is this the issue might be ?

regards

Reply all
Reply to author
Forward
0 new messages