blob: 0a26099658f4307f06fe594feb3fc046ff267076 [file] [log] [blame]
Eric Wongd5e673b2006-06-24 18:29:49 -07001#!/bin/sh
2#
3# Copyright (c) 2006 Eric Wong
4#
5
6test_description='git rebase --merge --skip tests'
7
8. ./test-lib.sh
9
10# we assume the default git-am -3 --skip strategy is tested independently
11# and always works :)
12
Eric Wongd5e673b2006-06-24 18:29:49 -070013test_expect_success setup '
14 echo hello > hello &&
15 git add hello &&
16 git commit -m "hello" &&
17 git branch skip-reference &&
18
19 echo world >> hello &&
20 git commit -a -m "hello world" &&
21 echo goodbye >> hello &&
22 git commit -a -m "goodbye" &&
23
24 git checkout -f skip-reference &&
25 echo moo > hello &&
26 git commit -a -m "we should skip this" &&
27 echo moo > cow &&
28 git add cow &&
29 git commit -m "this should not be skipped" &&
30 git branch pre-rebase skip-reference &&
31 git branch skip-merge skip-reference
32 '
33
Junio C Hamano41ac4142008-02-01 01:50:53 -080034test_expect_success 'rebase with git am -3 (default)' '
35 ! git rebase master
Junio C Hamano4be60962006-09-17 01:04:24 -070036'
Eric Wongd5e673b2006-06-24 18:29:49 -070037
38test_expect_success 'rebase --skip with am -3' '
Eric Wongd5e673b2006-06-24 18:29:49 -070039 git rebase --skip
40 '
Johannes Schindelin3f735b62007-11-12 13:11:46 +000041
42test_expect_success 'rebase moves back to skip-reference' '
43 test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
44 git branch post-rebase &&
45 git reset --hard pre-rebase &&
46 ! git rebase master &&
47 echo "hello" > hello &&
48 git add hello &&
49 git rebase --continue &&
50 test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
51 git reset --hard post-rebase
52'
53
Eric Wongd5e673b2006-06-24 18:29:49 -070054test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
55
Junio C Hamano41ac4142008-02-01 01:50:53 -080056test_expect_success 'rebase with --merge' '! git rebase --merge master'
Eric Wongd5e673b2006-06-24 18:29:49 -070057
58test_expect_success 'rebase --skip with --merge' '
Eric Wongd5e673b2006-06-24 18:29:49 -070059 git rebase --skip
60 '
61
62test_expect_success 'merge and reference trees equal' \
Junio C Hamano5be60072007-07-02 22:52:14 -070063 'test -z "`git diff-tree skip-merge skip-reference`"'
Eric Wongd5e673b2006-06-24 18:29:49 -070064
Johannes Schindelin3f735b62007-11-12 13:11:46 +000065test_expect_success 'moved back to branch correctly' '
66 test refs/heads/skip-merge = $(git symbolic-ref HEAD)
67'
68
Eric Wongd5e673b2006-06-24 18:29:49 -070069test_debug 'gitk --all & sleep 1'
70
71test_done