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