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

wanlin wanlinzhu at gmail.com
Mon Nov 22 05:52:42 EST 2010


On Mon, Nov 22, 2010 at 2:37 AM, Marcus D. Hanwell <
marcus.hanwell at kitware.com> wrote:

> On Nov 21, 2010, at 6:22 AM, wanlin wrote:
>
> When making changes in uploaded changes, i input
> git rebase -i HEAD~2
>
> Two commits appear in the editor, i changed the second as edit
>
> *pick 18193dd Remove bug in
> NeighborhoodAlgorithm::ImageBoundaryFacesCalculator
> e 6bfb20c Remove bug in NeighborhoodAlgorithm::ImageBoundaryFacesCalculator
> *
>
> then ensure the second commit has the same change-ID with the first one.
> but when i push them
>
>
> This sounds like you edited the commit messages so that both of the commits
> in your topic have the same Change-Id - is that what you did? If so, that is
> not correct. If you had the Gerrit hook activated you do not need to touch
> the Change-Id lines, if you didn't then each commit needs to match the
> Change-Id for that commit in Gerrit. This is why we strongly recommend that
> people activate these hooks if they weren't already activated (default in
> updated SetupForDevelopment.sh script).
>
> Sorry, i am both new for git and gerrit.

Yes, i have two commits with same Change-Id, The first commit is the one for
patch1(which has been pushed), i though i need to pick it as well for
patch2, the second commit is for patch2.

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. 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)

>
> git push gerrit HEAD:refs/for/master/NeighborhoodAlgorithm
>
> It prompted the following error:
>
>  ! [remote rejected] HEAD -> refs/for/master/NeighborhoodAlgorithm (squash
> commits first)
> error: failed to push some refs to 'wanlin at review.source.kitware.com:ITK'
>
>
> This looks like you are trying to push a topic with two or more commits,
> that have the same Change-Id. That is why it is saying to squash first, you
> cannot have two different commits with the same Change-Id.
>
> I saw other's topic, under the same change-Id, there are 2 or 3 patches
with different commit id, aren't they different commits with the same
Change-Id?


> Just make the Change-Id for each commit match what is in Gerrit. In future,
> if you have the local Gerrit hook on you need never edit the Change-Id lines
> - they will be inserted for you after your local commit is created. You can
> edit, and then just repush to Gerrit.
>


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

For patch 2

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


Many thanks


wanlin




> Marcus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20101122/202a03f8/attachment.htm>


More information about the Insight-developers mailing list