ASAP stop doing rebases when merging. It can create duplicate commits with 
different SHA1s.  This is actually happening in our repository:

https://htcondor-wiki.cs.wisc.edu/index.cgi/chngview?cn=41387
https://htcondor-wiki.cs.wisc.edu/index.cgi/chngview?cn=41474

When you merge from two different locations, the rebase will rewrite the 
previous rebase.  (To be fair, that's exactly what it's advertised as doing.) 
This can easily happen when working on a topic branch with another person and 
occasionally merging master into the branch. 

For the curious, the attached script creates a toy repository that exhibits the 
problem.

-- 
Alan De Smet                 Center for High Throughput Computing
ades...@cs.wisc.edu                       http://chtc.cs.wisc.edu
#! /bin/sh

# Bail on failure
set -e

mkdir test.git
pushd test.git
git --bare init
popd

mkdir 1
pushd 1
git clone ../test.git
cd test
cp /etc/services ./
git add services 
git commit -m "Start"
git push
popd

mkdir 2
pushd 2
git clone ../test.git/
popd

mkdir 3
pushd 3
git clone ../test.git/
popd

pushd 2/test
git branch newbranch
git checkout newbranch
rm services
(echo "start" ; cat /etc/services) > services
git commit -a -m "add start"
git push --set-upstream origin newbranch
perl -pi -e 's/^start$/START/' services 
git commit -a -m "capitalize start"
popd

pushd 3/test
git pull
git checkout newbranch
echo end >> services
git commit -a -m "add end"
git push
popd

pushd 1/test
perl -pi -e 's/00/XX/' services 
git commit -a -m "00 to XX"
git push
popd

pushd 2/test
git fetch
git rebase origin/master
git rebase origin/newbranch
git checkout master
git pull
popd

pushd 2/test
cat <<END


The following two lines should identical, as they represent
the same commit. However, the "rebase merge" rewrote it, so 
now there are two distinct commits.

END
git log --grep XX | grep commit
git checkout newbranch > /dev/null 2>&1
git log --grep XX | grep commit
cat <<END

You can manually check this by going into 2/test and running:
git checkout master
git log --grep XX
git checkout newbranch 
git log --grep XX
END

_______________________________________________
HTCondor-devel mailing list
HTCondor-devel@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-devel

Reply via email to