]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3405-rebase-malformed.sh
Merge branch 'wb/fsmonitor-bitmap-fix'
[thirdparty/git.git] / t / t3405-rebase-malformed.sh
1 #!/bin/sh
2
3 test_description='rebase should handle arbitrary git message'
4
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-rebase.sh
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
16 cat >G <<\EOF
17 commit log message containing a diff
18 EOF
19
20
21 test_expect_success setup '
22
23 >file1 &&
24 >file2 &&
25 git add file1 file2 &&
26 test_tick &&
27 git commit -m "Initial commit" &&
28 git branch diff-in-message &&
29 git branch empty-message-merge &&
30
31 git checkout -b multi-line-subject &&
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
39 git checkout diff-in-message &&
40 echo "commit log message containing a diff" >G &&
41 echo "" >>G &&
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
50 git checkout empty-message-merge &&
51 echo file3 >file3 &&
52 git add file3 &&
53 git commit --allow-empty-message -m "" &&
54
55 git checkout master &&
56
57 echo One >file1 &&
58 test_tick &&
59 git add file1 &&
60 git commit -m "Second commit"
61 '
62
63 test_expect_success 'rebase commit with multi-line subject' '
64
65 git rebase master multi-line-subject &&
66 git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 &&
67
68 test_cmp F0 F1 &&
69 test_cmp F F0
70 '
71
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
79 test_expect_success 'rebase -m commit with empty message' '
80 git rebase -m master empty-message-merge
81 '
82
83 test_expect_success 'rebase -i commit with empty message' '
84 git checkout diff-in-message &&
85 set_fake_editor &&
86 test_must_fail env FAKE_COMMIT_MESSAGE=" " FAKE_LINES="reword 1" \
87 git rebase -i HEAD^
88 '
89
90 test_done