Issue 2374: duplicated commits in the repository ,even in the same branch
Status:  Released
Owner: ----
Closed:  Mar 2014
Project Member Reported by bruce.zu@sonymobile.com, Dec 30, 2013
************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

Affected Version:
Gerrit master a76877cfb0d9aa56fc9246683b3d4ac9131d8c12  
(v2.8-955-ga76877c)

What steps will reproduce the problem?
1.create a project with init commit, configure "Required Change-Id in commit message" to be FALSE
2. locally git clone ...  //the init commit revison:0a146c9; no Chane-Id.
3. git push -f origin HEAD:refs/heads/test //create a branch
4  echo 'test' > test.txt; git add . ; git commit -m "test"; // new commit revison:c880078, no Change-Id.
5 git push origin HEAD:refs/for/master //get change '1' 
6 git push origin HEAD:refs/for/test 
    ...   error "(no new changes)"
  // one commit with same revision should be unique in project scope. 

7 git commit --amend //updated commit revison: 6fc3829, no Change-Id
8 git push origin HEAD:refs/for/test // get change '2'
9 git push origin HEAD:refs/for/master
     ...   error "(no new changes)"
10 git push origin HEAD:refs/changes/1  //duplicated commit (revision 6fc3829) now on master and test branch. this behavior is not same with that of 'push...refs/for'

----------
11 git checkout -b master-change2 0a146c9 //create local branch master2 with the init commit

12 echo master-change2 >change2.txt; git add . ; git commit -m "change2 on master"; //create commit 3bfcee, no Change-Id
13 git push origin HEAD:refs/for/master //get change '3'
14 git push origin 6fc3829:refs/changes/3  // duplicated commit (revision 6fc3829) now on change '1' and change '3' , 2 changes of same master branch. this behavior is not same with that of 'push...refs/for'


-----------------------
create another project with "Required Change-Id in commit message" is TRUE  
repeat same steps. (need download the commit-message and do 'git commit --ammend 'on the first push. from then on, do not change the Change-Id in each steps) the result is same.
     

What is the expected output? What do you see instead?
'push...refs/changes' should also have the same logic of 'checking commit exist' with that of 'push...refs/for' to prevent duplicated commits in the same repository. 

Please provide any additional information below.

Dec 30, 2013
Project Member #2 bruce.zu@sonymobile.com
 https://gerrit-review.googlesource.com/52762
 will prevent 'push...refs/changes' from creating duplicated commits on step 10 and 14 , just keep same behavior with 'push...refs/for'.
Jan 9, 2014
Project Member #3 david.pu...@sonymobile.com
(No comment was entered for this change.)
Status: ChangeUnderReview
Mar 11, 2014
Project Member #4 david.pu...@sonymobile.com
(No comment was entered for this change.)
Status: Submitted
Labels: FixedIn-2.8.2
Mar 11, 2014
Project Member #5 david.pu...@sonymobile.com
(No comment was entered for this change.)
Status: Released