Merge pull request #285 from dscho/readme
[git/mingw/4msysgit.git] / t / t3406-rebase-message.sh
blob0392e36d2364c8149f2a628a0901f113b7a5875f
1 #!/bin/sh
3 test_description='messages from rebase operation'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 test_commit O fileO &&
9 test_commit X fileX &&
10 test_commit A fileA &&
11 test_commit B fileB &&
12 test_commit Y fileY &&
14 git checkout -b topic O &&
15 git cherry-pick A B &&
16 test_commit Z fileZ &&
17 git tag start
20 cat >expect <<\EOF
21 Already applied: 0001 A
22 Already applied: 0002 B
23 Committed: 0003 Z
24 EOF
26 test_expect_success 'rebase -m' '
27 git rebase -m master >report &&
28 sed -n -e "/^Already applied: /p" \
29 -e "/^Committed: /p" report >actual &&
30 test_cmp expect actual
33 test_expect_success 'rebase against master twice' '
34 git rebase master >out &&
35 test_i18ngrep "Current branch topic is up to date" out
38 test_expect_success 'rebase against master twice with --force' '
39 git rebase --force-rebase master >out &&
40 test_i18ngrep "Current branch topic is up to date, rebase forced" out
43 test_expect_success 'rebase against master twice from another branch' '
44 git checkout topic^ &&
45 git rebase master topic >out &&
46 test_i18ngrep "Current branch topic is up to date" out
49 test_expect_success 'rebase fast-forward to master' '
50 git checkout topic^ &&
51 git rebase topic >out &&
52 test_i18ngrep "Fast-forwarded HEAD to topic" out
55 test_expect_success 'rebase --stat' '
56 git reset --hard start &&
57 git rebase --stat master >diffstat.txt &&
58 grep "^ fileX | *1 +$" diffstat.txt
61 test_expect_success 'rebase w/config rebase.stat' '
62 git reset --hard start &&
63 git config rebase.stat true &&
64 git rebase master >diffstat.txt &&
65 grep "^ fileX | *1 +$" diffstat.txt
68 test_expect_success 'rebase -n overrides config rebase.stat config' '
69 git reset --hard start &&
70 git config rebase.stat true &&
71 git rebase -n master >diffstat.txt &&
72 ! grep "^ fileX | *1 +$" diffstat.txt
75 # Output to stderr:
77 # "Does not point to a valid commit: invalid-ref"
79 # NEEDSWORK: This "grep" is fine in real non-C locales, but
80 # GETTEXT_POISON poisons the refname along with the enclosing
81 # error message.
82 test_expect_success 'rebase --onto outputs the invalid ref' '
83 test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
84 test_i18ngrep "invalid-ref" err
87 test_done