interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t3405-rebase-malformed.sh

93 lines · 1890 bytes Raw Blame History
1#!/bin/sh
2
3test_description='rebase should handle arbitrary git message'
4
5GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8. ./test-lib.sh
9. "$TEST_DIRECTORY"/lib-rebase.sh
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
19cat >G <<\EOF
20commit log message containing a diff
21EOF
22
23
24test_expect_success setup '
25
26 >file1 &&
27 >file2 &&
28 git add file1 file2 &&
29 test_tick &&
30 git commit -m "Initial commit" &&
31 git branch diff-in-message &&
32 git branch empty-message-merge &&
33
34 git checkout -b multi-line-subject &&
35 cat F >file2 &&
36 git add file2 &&
37 test_tick &&
38 git commit -F F &&
39
40 commit_body HEAD >F0 &&
41
42 git checkout diff-in-message &&
43 echo "commit log message containing a diff" >G &&
44 echo "" >>G &&
45 cat G >file2 &&
46 git add file2 &&
47 git diff --cached >>G &&
48 test_tick &&
49 git commit -F G &&
50
51 commit_body HEAD >G0 &&
52
53 git checkout empty-message-merge &&
54 echo file3 >file3 &&
55 git add file3 &&
56 git commit --allow-empty-message -m "" &&
57
58 git checkout main &&
59
60 echo One >file1 &&
61 test_tick &&
62 git add file1 &&
63 git commit -m "Second commit"
64'
65
66test_expect_success 'rebase commit with multi-line subject' '
67
68 git rebase main multi-line-subject &&
69 commit_body HEAD >F1 &&
70
71 test_cmp F0 F1 &&
72 test_cmp F F0
73'
74
75test_expect_success 'rebase commit with diff in message' '
76 git rebase main diff-in-message &&
77 commit_body HEAD >G1 &&
78 test_cmp G0 G1 &&
79 test_cmp G G0
80'
81
82test_expect_success 'rebase -m commit with empty message' '
83 git rebase -m main empty-message-merge
84'
85
86test_expect_success 'rebase -i commit with empty message' '
87 git checkout diff-in-message &&
88 set_fake_editor &&
89 test_must_fail env FAKE_COMMIT_MESSAGE=" " FAKE_LINES="reword 1" \
90 git rebase -i HEAD^
91'
92
93test_done