Sync with 2.12.5
[gitweb.git] / t / t5520-pull.sh
index 551844584fc7b8ff71667dd61fcba62889ded69f..f15f7a332960f15c7af32a3c1e7a66f5a8a68989 100755 (executable)
@@ -255,6 +255,41 @@ test_expect_success '--rebase' '
        test new = "$(git show HEAD:file2)"
 '
 
+test_expect_success '--rebase fast forward' '
+       git reset --hard before-rebase &&
+       git checkout -b ff &&
+       echo another modification >file &&
+       git commit -m third file &&
+
+       git checkout to-rebase &&
+       git pull --rebase . ff &&
+       test "$(git rev-parse HEAD)" = "$(git rev-parse ff)" &&
+
+       # The above only validates the result.  Did we actually bypass rebase?
+       git reflog -1 >reflog.actual &&
+       sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
+       echo "OBJID HEAD@{0}: pull --rebase . ff: Fast-forward" >reflog.expected &&
+       test_cmp reflog.expected reflog.fuzzy
+'
+
+test_expect_success '--rebase --autostash fast forward' '
+       test_when_finished "
+               git reset --hard
+               git checkout to-rebase
+               git branch -D to-rebase-ff
+               git branch -D behind" &&
+       git branch behind &&
+       git checkout -b to-rebase-ff &&
+       echo another modification >>file &&
+       git add file &&
+       git commit -m mod &&
+
+       git checkout behind &&
+       echo dirty >file &&
+       git pull --rebase --autostash . to-rebase-ff &&
+       test "$(git rev-parse HEAD)" = "$(git rev-parse to-rebase-ff)"
+'
+
 test_expect_success '--rebase with conflicts shows advice' '
        test_when_finished "git rebase --abort; git checkout -f to-rebase" &&
        git checkout -b seq &&