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