My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1336: misleading error message "squash commits first"
5 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by tobias.o...@sap.com, Apr 18, 2012
Affected Version: 2.1.8, 2.2.2-rc1

Steps to reproduce the problem:
1. Create a commit with Change-Id A
2. Create a second commit with the same Change-Id A
3. Try to push both changes to Gerrit

You'll get the following error message
 ! [remote rejected] HEAD -> refs/for/master (squash commits first)

This message is
a) misleading - my first interpretation of it was that it is not possible to push multiple changes at once (and this even though I vaguely remembered having done this before; I had assumed that this was some configuration option I had not heard about before).
b) possibly incorrect - the root of the problem was the rare case according to [1], i.e. I had given the same Change-Id to two distinct commits. So the solution was to fix the Change-Id in one of them, and not to squash them together.

I'd propose to issue a different message, e.g. something like "cannot push commit which depends on a commit with the same Change-Id". Sure this is complicated, but so is the error case. Hopefully this will either point people in the right direction, or if they don't understand the message, encourage them to read the (good) documentation.


[1] https://git.wdf.sap.corp:8080/Documentation/error-squash-commits-first.html

Apr 18, 2012
Project Member #1 bklarson@gmail.com
I think the most common way users run into this error is when they meant to amend a commit, but accidentally create a new commit instead.  Then they have the original commit and a second commit with their fixes to that commit.  In this case, the error message is correct and they should squash the commits.

Perhaps a better error message would be something like "Multiple commits with the same Change-Id.  Perhaps you need to squash commits?" ?
Sign in to add a comment

Powered by Google Project Hosting