]>
Commit | Line | Data |
---|---|---|
d7f6bae2 JH |
1 | #!/bin/sh |
2 | ||
a2309494 | 3 | test_description='rebase should handle arbitrary git message' |
d7f6bae2 JH |
4 | |
5 | . ./test-lib.sh | |
a6c612b5 | 6 | . "$TEST_DIRECTORY"/lib-rebase.sh |
d7f6bae2 JH |
7 | |
8 | cat >F <<\EOF | |
9 | This is an example of a commit log message | |
10 | that does not conform to git commit convention. | |
11 | ||
12 | It has two paragraphs, but its first paragraph is not friendly | |
13 | to oneline summary format. | |
14 | EOF | |
15 | ||
a2309494 MZ |
16 | cat >G <<\EOF |
17 | commit log message containing a diff | |
18 | EOF | |
19 | ||
20 | ||
d7f6bae2 JH |
21 | test_expect_success setup ' |
22 | ||
23 | >file1 && | |
24 | >file2 && | |
25 | git add file1 file2 && | |
26 | test_tick && | |
27 | git commit -m "Initial commit" && | |
99094a7a | 28 | git branch diff-in-message && |
a6c612b5 | 29 | git branch empty-message-merge && |
d7f6bae2 | 30 | |
a2309494 | 31 | git checkout -b multi-line-subject && |
d7f6bae2 JH |
32 | cat F >file2 && |
33 | git add file2 && | |
34 | test_tick && | |
35 | git commit -F F && | |
36 | ||
37 | git cat-file commit HEAD | sed -e "1,/^\$/d" >F0 && | |
38 | ||
a2309494 MZ |
39 | git checkout diff-in-message && |
40 | echo "commit log message containing a diff" >G && | |
99094a7a | 41 | echo "" >>G && |
a2309494 MZ |
42 | cat G >file2 && |
43 | git add file2 && | |
44 | git diff --cached >>G && | |
45 | test_tick && | |
46 | git commit -F G && | |
47 | ||
48 | git cat-file commit HEAD | sed -e "1,/^\$/d" >G0 && | |
49 | ||
a6c612b5 GS |
50 | git checkout empty-message-merge && |
51 | echo file3 >file3 && | |
52 | git add file3 && | |
53 | git commit --allow-empty-message -m "" && | |
54 | ||
d7f6bae2 JH |
55 | git checkout master && |
56 | ||
57 | echo One >file1 && | |
58 | test_tick && | |
59 | git add file1 && | |
60 | git commit -m "Second commit" | |
61 | ' | |
62 | ||
a2309494 | 63 | test_expect_success 'rebase commit with multi-line subject' ' |
d7f6bae2 | 64 | |
a2309494 | 65 | git rebase master multi-line-subject && |
d7f6bae2 JH |
66 | git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 && |
67 | ||
82ebb0b6 JK |
68 | test_cmp F0 F1 && |
69 | test_cmp F F0 | |
d7f6bae2 JH |
70 | ' |
71 | ||
a2309494 MZ |
72 | test_expect_success 'rebase commit with diff in message' ' |
73 | git rebase master diff-in-message && | |
74 | git cat-file commit HEAD | sed -e "1,/^$/d" >G1 && | |
75 | test_cmp G0 G1 && | |
76 | test_cmp G G0 | |
77 | ' | |
78 | ||
a6c612b5 | 79 | test_expect_success 'rebase -m commit with empty message' ' |
b00bf1c9 | 80 | git rebase -m master empty-message-merge |
a6c612b5 GS |
81 | ' |
82 | ||
83 | test_expect_success 'rebase -i commit with empty message' ' | |
84 | git checkout diff-in-message && | |
85 | set_fake_editor && | |
a3ec9eaf | 86 | test_must_fail env FAKE_COMMIT_MESSAGE=" " FAKE_LINES="reword 1" \ |
b00bf1c9 | 87 | git rebase -i HEAD^ |
a6c612b5 GS |
88 | ' |
89 | ||
d7f6bae2 | 90 | test_done |