blob: 1f5122b632fb9d7829e7b5f28c2a2971e9ea04e7 [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
Nanako Shiraishi0cb0e142008-09-03 17:59:27 +090010# we assume the default git am -3 --skip strategy is tested independently
Eric Wongd5e673b2006-06-24 18:29:49 -070011# 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)' '
Stephan Beyerd492b312008-07-12 17:47:52 +020035 test_must_fail git rebase master
Junio C Hamano4be60962006-09-17 01:04:24 -070036'
Eric Wongd5e673b2006-06-24 18:29:49 -070037
Martin von Zweigbergk95135b02011-02-06 13:43:36 -050038test_expect_success 'rebase --skip can not be used with other options' '
39 test_must_fail git rebase -v --skip &&
40 test_must_fail git rebase --skip -v
41'
42
Eric Wongd5e673b2006-06-24 18:29:49 -070043test_expect_success 'rebase --skip with am -3' '
Eric Wongd5e673b2006-06-24 18:29:49 -070044 git rebase --skip
45 '
Johannes Schindelin3f735b62007-11-12 13:11:46 +000046
47test_expect_success 'rebase moves back to skip-reference' '
48 test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
49 git branch post-rebase &&
50 git reset --hard pre-rebase &&
Stephan Beyerd492b312008-07-12 17:47:52 +020051 test_must_fail git rebase master &&
Johannes Schindelin3f735b62007-11-12 13:11:46 +000052 echo "hello" > hello &&
53 git add hello &&
54 git rebase --continue &&
55 test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
56 git reset --hard post-rebase
57'
58
Eric Wongd5e673b2006-06-24 18:29:49 -070059test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
60
Stephan Beyerd492b312008-07-12 17:47:52 +020061test_expect_success 'rebase with --merge' '
62 test_must_fail git rebase --merge master
63'
Eric Wongd5e673b2006-06-24 18:29:49 -070064
65test_expect_success 'rebase --skip with --merge' '
Eric Wongd5e673b2006-06-24 18:29:49 -070066 git rebase --skip
Felipe Contreras15c73482013-05-28 07:54:29 -050067'
Eric Wongd5e673b2006-06-24 18:29:49 -070068
Felipe Contreras15c73482013-05-28 07:54:29 -050069test_expect_success 'merge and reference trees equal' '
Elia Pintoc82ec452015-12-22 16:27:46 +010070 test -z "$(git diff-tree skip-merge skip-reference)"
Felipe Contreras15c73482013-05-28 07:54:29 -050071'
Eric Wongd5e673b2006-06-24 18:29:49 -070072
Johannes Schindelin3f735b62007-11-12 13:11:46 +000073test_expect_success 'moved back to branch correctly' '
74 test refs/heads/skip-merge = $(git symbolic-ref HEAD)
75'
76
Eric Wongd5e673b2006-06-24 18:29:49 -070077test_debug 'gitk --all & sleep 1'
78
79test_done