[Insight-developers] Error when push second changes to gerrit

Brad King brad.king at kitware.com
Mon Nov 22 08:34:17 EST 2010


On 11/22/2010 05:52 AM, wanlin wrote:
> Yes, i have two commits with same Change-Id

Gerrit expects every commit to have a unique Change-Id.

> It's my mistake not run Gerrit hook at first. I run 
> SetupForDevelopment.sh after submit the first commit, now i have the
> Gerrit hooked.

BTW, in the future fresh clones of ITK will remind you to run that
script when you try the first commit.  Previously it just asked you
to install the local hooks.  Now it asks for the whole script.

> I have a test, in the same branch, i commit twice, but i
> found the Change-Ids are different,  If i put the current commit, it
> will give a new change number. Now i am confused, to make the second
> commit appeared in the same topic as patch2, shouldn't i keep the
> Change-Id the same, (seems hook of Gerrit just give the id
> automatically, but not keep them same)

The 'topic' name in Gerrit just comes from the

 refs/for/master/<topic>

part of the push command.  All new commits pushed by the command
get marked as part of that topic.  Each one still has a separate
change id.

> Can you show me the procedures if the Gerrit hooked?
> 
> For patch 1
> 
> git add ...
> git commit -a
> git push gerrit HEAD:refs/for/master/topic

Leave out the push here.  Prepare all commits on the topic first.

> For patch 2
> 
> change some files.
> git add files
> git commit -a
> git push gerrit HEAD:refs/for/master/  ???

Now put the topic name here on the one and only push.

Please see instructions here:

  http://www.itk.org/Wiki/ITK/Git/Develop

-Brad


More information about the Insight-developers mailing list