tests: Introduce test_seq
[git/mingw.git] / t / t3406-rebase-message.sh
blob6898377910f9fce8ccc73fba7b8140dff53d7ec6
1 #!/bin/sh
3 test_description='messages from rebase operation'
5 . ./test-lib.sh
7 quick_one () {
8 echo "$1" >"file$1" &&
9 git add "file$1" &&
10 test_tick &&
11 git commit -m "$1"
14 test_expect_success setup '
15 quick_one O &&
16 git branch topic &&
17 quick_one X &&
18 quick_one A &&
19 quick_one B &&
20 quick_one Y &&
22 git checkout topic &&
23 quick_one A &&
24 quick_one B &&
25 quick_one Z &&
26 git tag start
30 cat >expect <<\EOF
31 Already applied: 0001 A
32 Already applied: 0002 B
33 Committed: 0003 Z
34 EOF
36 test_expect_success 'rebase -m' '
38 git rebase -m master >report &&
39 sed -n -e "/^Already applied: /p" \
40 -e "/^Committed: /p" report >actual &&
41 test_cmp expect actual
45 test_expect_success 'rebase --stat' '
46 git reset --hard start &&
47 git rebase --stat master >diffstat.txt &&
48 grep "^ fileX | *1 +$" diffstat.txt
51 test_expect_success 'rebase w/config rebase.stat' '
52 git reset --hard start &&
53 git config rebase.stat true &&
54 git rebase master >diffstat.txt &&
55 grep "^ fileX | *1 +$" diffstat.txt
58 test_expect_success 'rebase -n overrides config rebase.stat config' '
59 git reset --hard start &&
60 git config rebase.stat true &&
61 git rebase -n master >diffstat.txt &&
62 ! grep "^ fileX | *1 +$" diffstat.txt
65 test_expect_success 'rebase --onto outputs the invalid ref' '
66 test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
67 grep "invalid-ref" err
70 test_done