From: Stephen Haberman Date: Tue, 11 Nov 2008 23:06:43 +0000 (-0600) Subject: Fix pull in the case when we have no local changes. X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=97f6d595b2baa207390326ad8e9832133881e7af;p=git-central.git Fix pull in the case when we have no local changes. --- diff --git a/scripts/pull b/scripts/pull index c2313ba..d448f38 100644 --- a/scripts/pull +++ b/scripts/pull @@ -13,5 +13,9 @@ if [[ $? -ne 0 ]] ; then exit $? fi -GIT_EDITOR=: git rebase -p -i "origin/$branch_name" +if test $(git rev-parse HEAD) = $(git merge-base HEAD origin/$branch_name) ; then + git rebase "origin/$branch_name" +else + GIT_EDITOR=: git rebase -p -i "origin/$branch_name" +fi diff --git a/tests/t5200-pull.sh b/tests/t5200-pull.sh index 6fdfb07..911f7a4 100644 --- a/tests/t5200-pull.sh +++ b/tests/t5200-pull.sh @@ -63,7 +63,22 @@ test_expect_success 'pull does a rebase but does not fuck up merges' ' # Merge stable locally too--should conflict git checkout topic2 && pull && - test 1 = $(git rev-list --all --pretty=oneline | grep "replayed" | wc -l) + test 1 = $(git rev-list --all --pretty=oneline | grep "replayed" | wc -l) && + push +' + +test_expect_success 'pull moves when we have no local changes' ' + git checkout topic2 && + + # Move topic2 on the server + cd server && + git checkout topic2 && + echo "$test_name" > a.topic2.server && + git commit -a -m "move topic2 on the server" && + cd .. && + + pull && + test $(git rev-parse HEAD) = $(git rev-parse origin/topic2) ' test_done