]>
Commit | Line | Data |
---|---|---|
7afa845e JS |
1 | #!/bin/sh |
2 | ||
3 | test_description='messages from rebase operation' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | quick_one () { | |
8 | echo "$1" >"file$1" && | |
9 | git add "file$1" && | |
10 | test_tick && | |
11 | git commit -m "$1" | |
12 | } | |
13 | ||
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 && | |
21 | ||
22 | git checkout topic && | |
23 | quick_one A && | |
24 | quick_one B && | |
a9c3821c TAV |
25 | quick_one Z && |
26 | git tag start | |
7afa845e JS |
27 | |
28 | ' | |
29 | ||
30 | cat >expect <<\EOF | |
31 | Already applied: 0001 A | |
32 | Already applied: 0002 B | |
33 | Committed: 0003 Z | |
34 | EOF | |
35 | ||
36 | test_expect_success 'rebase -m' ' | |
37 | ||
38 | git rebase -m master >report && | |
39 | sed -n -e "/^Already applied: /p" \ | |
40 | -e "/^Committed: /p" report >actual && | |
82ebb0b6 | 41 | test_cmp expect actual |
7afa845e JS |
42 | |
43 | ' | |
44 | ||
a9c3821c | 45 | test_expect_success 'rebase --stat' ' |
a48fcd83 | 46 | git reset --hard start && |
a9c3821c TAV |
47 | git rebase --stat master >diffstat.txt && |
48 | grep "^ fileX | *1 +$" diffstat.txt | |
49 | ' | |
50 | ||
51 | test_expect_success 'rebase w/config rebase.stat' ' | |
a48fcd83 | 52 | git reset --hard start && |
a9c3821c TAV |
53 | git config rebase.stat true && |
54 | git rebase master >diffstat.txt && | |
55 | grep "^ fileX | *1 +$" diffstat.txt | |
56 | ' | |
57 | ||
58 | test_expect_success 'rebase -n overrides config rebase.stat config' ' | |
a48fcd83 | 59 | git reset --hard start && |
a9c3821c TAV |
60 | git config rebase.stat true && |
61 | git rebase -n master >diffstat.txt && | |
62 | ! grep "^ fileX | *1 +$" diffstat.txt | |
63 | ' | |
64 | ||
c7108bf9 JX |
65 | # Output to stderr: |
66 | # | |
67 | # "Does not point to a valid commit: invalid-ref" | |
68 | # | |
69 | # NEEDSWORK: This "grep" is fine in real non-C locales, but | |
70 | # GETTEXT_POISON poisons the refname along with the enclosing | |
71 | # error message. | |
9180feaf EFL |
72 | test_expect_success 'rebase --onto outputs the invalid ref' ' |
73 | test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err && | |
c7108bf9 | 74 | test_i18ngrep "invalid-ref" err |
9180feaf EFL |
75 | ' |
76 | ||
7afa845e | 77 | test_done |