#!/bin/bash # git-rebase is supposed to drop commits that it finds in both the # local and upstream branches. As of 1.9.0, this isn't happening. # This script reproduces the problem. # I've bisected the issue down to commit bb3f458. Reverting that commit # solves the problem. # Run this in a directory where you have create privs. # At the end, if there are conflicts, then the test has failed. # Create a repo. mkdir rebase-issue cd rebase-issue mkdir maint cd maint git init # Create a README file and put some text in it echo "Hi there!" >README git add README git commit -a -m "Initial commit" # Clone the repo for "dev" cd .. git clone maint dev # Dev makes *two* changes to the *same* area. cd dev # edit something, make some typos echo "Freekwently Mispeled Werdz" >README git commit -a -m "First change" # edit same thing, fix those typos echo "Frequently Misspelled Words" >README git commit -a -m "Second change" # Create patches to send to maintainer... git format-patch -M origin/master mv *.patch ../maint # Add a third change that should make it through for completeness. echo "Frequently Misspelled Words version 2" >README git commit -a -m "Third change" # We have to sleep (to make sure the times do not match?). # If we don't, this script will succeed on fast machines. # This can probably be reduced to 2 which should guarantee that # the seconds will turn over on the clock. echo echo "Waiting 5 seconds to make sure apply time is different from patch time..." sleep 5 echo echo "Maint applies patches..." cd ../maint git am -3 *.patch echo echo "Dev does the fetch/rebase..." cd ../dev git fetch git rebase echo git --version