2006-01-08 01:39:48 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git rebase should detect patches integrated upstream
|
|
|
|
|
|
|
|
This test cherry-picks one local change of two into master branch, and
|
|
|
|
checks that git rebase succeeds with only the second patch in the
|
|
|
|
local branch.
|
|
|
|
'
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2011-12-09 17:59:11 +01:00
|
|
|
test_expect_success 'prepare repository with topic branch' '
|
2011-12-10 09:17:54 +01:00
|
|
|
test_commit A &&
|
2011-12-09 17:59:11 +01:00
|
|
|
git checkout -b my-topic-branch &&
|
2011-12-10 09:17:54 +01:00
|
|
|
test_commit B &&
|
|
|
|
test_commit C &&
|
2011-12-09 17:59:11 +01:00
|
|
|
git checkout -f master &&
|
2011-12-10 09:17:54 +01:00
|
|
|
test_commit A2 A.t
|
2006-01-08 01:39:48 +01:00
|
|
|
'
|
|
|
|
|
2011-12-09 17:59:11 +01:00
|
|
|
test_expect_success 'pick top patch from topic branch into master' '
|
2011-12-10 09:17:54 +01:00
|
|
|
git cherry-pick C &&
|
|
|
|
git checkout -f my-topic-branch
|
2006-01-08 01:39:48 +01:00
|
|
|
'
|
|
|
|
|
2011-12-09 17:59:11 +01:00
|
|
|
test_debug '
|
|
|
|
git cherry master &&
|
|
|
|
git format-patch -k --stdout --full-index master >/dev/null &&
|
|
|
|
gitk --all & sleep 1
|
2006-01-08 01:39:48 +01:00
|
|
|
'
|
|
|
|
|
2011-12-09 17:59:11 +01:00
|
|
|
test_expect_success 'rebase topic branch against new master and check git am did not get halted' '
|
|
|
|
git rebase master &&
|
2011-12-10 09:17:54 +01:00
|
|
|
test_path_is_missing .git/rebase-apply
|
2011-12-09 17:59:11 +01:00
|
|
|
'
|
2006-01-08 01:39:48 +01:00
|
|
|
|
2011-12-09 17:59:11 +01:00
|
|
|
test_expect_success 'rebase --merge topic branch that was partially merged upstream' '
|
2011-12-10 09:17:54 +01:00
|
|
|
git reset --hard C &&
|
|
|
|
git rebase --merge master &&
|
|
|
|
test_path_is_missing .git/rebase-merge
|
2011-12-09 17:59:11 +01:00
|
|
|
'
|
2006-06-25 03:29:47 +02:00
|
|
|
|
2012-06-27 18:22:01 +02:00
|
|
|
test_expect_success 'rebase ignores empty commit' '
|
|
|
|
git reset --hard A &&
|
|
|
|
git commit --allow-empty -m empty &&
|
|
|
|
test_commit D &&
|
|
|
|
git rebase C &&
|
2012-08-09 17:39:51 +02:00
|
|
|
test "$(git log --format=%s C..)" = "D"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'rebase --keep-empty' '
|
|
|
|
git reset --hard D &&
|
|
|
|
git rebase --keep-empty C &&
|
|
|
|
test "$(git log --format=%s C..)" = "D
|
|
|
|
empty"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '
|
|
|
|
git reset --hard A &&
|
|
|
|
git commit --allow-empty -m also-empty &&
|
|
|
|
git rebase --keep-empty D &&
|
|
|
|
test "$(git log --format=%s A..)" = "also-empty
|
|
|
|
D
|
|
|
|
empty"
|
2012-06-27 18:22:01 +02:00
|
|
|
'
|
|
|
|
|
2006-01-08 01:39:48 +01:00
|
|
|
test_done
|