Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2006 Eric Wong |
| 4 | # |
| 5 | |
| 6 | test_description='git rebase --merge --skip tests' |
| 7 | |
| 8 | . ./test-lib.sh |
| 9 | |
Nanako Shiraishi | 0cb0e14 | 2008-09-03 17:59:27 +0900 | [diff] [blame] | 10 | # we assume the default git am -3 --skip strategy is tested independently |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 11 | # and always works :) |
| 12 | |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 13 | test_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 Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 34 | test_expect_success 'rebase with git am -3 (default)' ' |
Stephan Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 35 | test_must_fail git rebase master |
Junio C Hamano | 4be6096 | 2006-09-17 01:04:24 -0700 | [diff] [blame] | 36 | ' |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 37 | |
Martin von Zweigbergk | 95135b0 | 2011-02-06 13:43:36 -0500 | [diff] [blame] | 38 | test_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 Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 43 | test_expect_success 'rebase --skip with am -3' ' |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 44 | git rebase --skip |
| 45 | ' |
Johannes Schindelin | 3f735b6 | 2007-11-12 13:11:46 +0000 | [diff] [blame] | 46 | |
| 47 | test_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 Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 51 | test_must_fail git rebase master && |
Johannes Schindelin | 3f735b6 | 2007-11-12 13:11:46 +0000 | [diff] [blame] | 52 | 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 Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 59 | test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge' |
| 60 | |
Stephan Beyer | d492b31 | 2008-07-12 17:47:52 +0200 | [diff] [blame] | 61 | test_expect_success 'rebase with --merge' ' |
| 62 | test_must_fail git rebase --merge master |
| 63 | ' |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 64 | |
| 65 | test_expect_success 'rebase --skip with --merge' ' |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 66 | git rebase --skip |
Felipe Contreras | 15c7348 | 2013-05-28 07:54:29 -0500 | [diff] [blame] | 67 | ' |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 68 | |
Felipe Contreras | 15c7348 | 2013-05-28 07:54:29 -0500 | [diff] [blame] | 69 | test_expect_success 'merge and reference trees equal' ' |
Elia Pinto | c82ec45 | 2015-12-22 16:27:46 +0100 | [diff] [blame] | 70 | test -z "$(git diff-tree skip-merge skip-reference)" |
Felipe Contreras | 15c7348 | 2013-05-28 07:54:29 -0500 | [diff] [blame] | 71 | ' |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 72 | |
Johannes Schindelin | 3f735b6 | 2007-11-12 13:11:46 +0000 | [diff] [blame] | 73 | test_expect_success 'moved back to branch correctly' ' |
| 74 | test refs/heads/skip-merge = $(git symbolic-ref HEAD) |
| 75 | ' |
| 76 | |
Eric Wong | d5e673b | 2006-06-24 18:29:49 -0700 | [diff] [blame] | 77 | test_debug 'gitk --all & sleep 1' |
| 78 | |
| 79 | test_done |