2008-02-29 22:08:47 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='git rebase --abort tests'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2008-05-04 05:37:51 +00:00
|
|
|
### Test that we handle space characters properly
|
|
|
|
work_dir="$(pwd)/test dir"
|
|
|
|
|
2008-02-29 22:08:47 +00:00
|
|
|
test_expect_success setup '
|
2008-05-04 05:37:51 +00:00
|
|
|
mkdir -p "$work_dir" &&
|
|
|
|
cd "$work_dir" &&
|
|
|
|
git init &&
|
2008-02-29 22:08:47 +00:00
|
|
|
echo a > a &&
|
|
|
|
git add a &&
|
|
|
|
git commit -m a &&
|
|
|
|
git branch to-rebase &&
|
|
|
|
|
|
|
|
echo b > a &&
|
|
|
|
git commit -a -m b &&
|
|
|
|
echo c > a &&
|
|
|
|
git commit -a -m c &&
|
|
|
|
|
|
|
|
git checkout to-rebase &&
|
|
|
|
echo d > a &&
|
|
|
|
git commit -a -m "merge should fail on this" &&
|
|
|
|
echo e > a &&
|
|
|
|
git commit -a -m "merge should fail on this, too" &&
|
|
|
|
git branch pre-rebase
|
|
|
|
'
|
|
|
|
|
2008-03-01 11:12:13 +00:00
|
|
|
testrebase() {
|
|
|
|
type=$1
|
|
|
|
dotest=$2
|
2008-02-29 22:08:47 +00:00
|
|
|
|
2008-03-01 11:12:13 +00:00
|
|
|
test_expect_success "rebase$type --abort" '
|
2008-05-04 05:37:51 +00:00
|
|
|
cd "$work_dir" &&
|
2008-03-01 11:12:13 +00:00
|
|
|
# Clean up the state from the previous one
|
2008-05-04 05:37:51 +00:00
|
|
|
git reset --hard pre-rebase &&
|
|
|
|
test_must_fail git rebase$type master &&
|
|
|
|
test -d "$dotest" &&
|
2008-03-01 11:12:13 +00:00
|
|
|
git rebase --abort &&
|
|
|
|
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
|
2008-05-04 05:37:51 +00:00
|
|
|
test ! -d "$dotest"
|
2008-03-01 11:12:13 +00:00
|
|
|
'
|
2008-02-29 22:08:47 +00:00
|
|
|
|
2008-03-01 11:12:13 +00:00
|
|
|
test_expect_success "rebase$type --abort after --skip" '
|
2008-05-04 05:37:51 +00:00
|
|
|
cd "$work_dir" &&
|
2008-03-01 11:12:13 +00:00
|
|
|
# Clean up the state from the previous one
|
2008-05-04 05:37:51 +00:00
|
|
|
git reset --hard pre-rebase &&
|
|
|
|
test_must_fail git rebase$type master &&
|
|
|
|
test -d "$dotest" &&
|
2008-03-01 11:12:13 +00:00
|
|
|
test_must_fail git rebase --skip &&
|
|
|
|
test $(git rev-parse HEAD) = $(git rev-parse master) &&
|
2008-09-03 08:59:27 +00:00
|
|
|
git rebase --abort &&
|
2008-03-01 11:12:13 +00:00
|
|
|
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
|
2008-05-04 05:37:51 +00:00
|
|
|
test ! -d "$dotest"
|
2008-03-01 11:12:13 +00:00
|
|
|
'
|
2008-02-29 22:08:47 +00:00
|
|
|
|
2008-03-01 11:12:13 +00:00
|
|
|
test_expect_success "rebase$type --abort after --continue" '
|
2008-05-04 05:37:51 +00:00
|
|
|
cd "$work_dir" &&
|
2008-03-01 11:12:13 +00:00
|
|
|
# Clean up the state from the previous one
|
2008-05-04 05:37:51 +00:00
|
|
|
git reset --hard pre-rebase &&
|
|
|
|
test_must_fail git rebase$type master &&
|
|
|
|
test -d "$dotest" &&
|
2008-03-01 11:12:13 +00:00
|
|
|
echo c > a &&
|
|
|
|
echo d >> a &&
|
|
|
|
git add a &&
|
|
|
|
test_must_fail git rebase --continue &&
|
|
|
|
test $(git rev-parse HEAD) != $(git rev-parse master) &&
|
|
|
|
git rebase --abort &&
|
|
|
|
test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) &&
|
2008-05-04 05:37:51 +00:00
|
|
|
test ! -d "$dotest"
|
2008-03-01 11:12:13 +00:00
|
|
|
'
|
|
|
|
}
|
2008-02-29 22:08:47 +00:00
|
|
|
|
2008-07-21 10:51:02 +00:00
|
|
|
testrebase "" .git/rebase-apply
|
2008-07-16 01:33:44 +00:00
|
|
|
testrebase " --merge" .git/rebase-merge
|
2008-02-29 22:08:47 +00:00
|
|
|
|
|
|
|
test_done
|