blob: 7b4607d72f2748df9d0800a5e471e4af1d6ae32a [file] [log] [blame]
Junio C Hamano5e835ca2008-04-16 12:50:48 -07001#!/bin/sh
2
3test_description='rebasing a commit with multi-line first paragraph.'
4
Johannes Schindelind1c02d92020-11-18 23:44:25 +00005GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
Johannes Schindelin334afbc2020-11-18 23:44:19 +00006export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
Ævar Arnfjörð Bjarmason7a98d9a2022-04-13 22:01:47 +02008TEST_PASSES_SANITIZE_LEAK=true
Junio C Hamano5e835ca2008-04-16 12:50:48 -07009. ./test-lib.sh
10
11test_expect_success setup '
12
13 >file &&
14 git add file &&
15 test_tick &&
16 git commit -m initial &&
17
18 echo hello >file &&
19 test_tick &&
20 git commit -a -m "A sample commit log message that has a long
21summary that spills over multiple lines.
22
Jonathan Niedera48fcd82010-10-30 20:46:54 -050023But otherwise with a sane description." &&
Junio C Hamano5e835ca2008-04-16 12:50:48 -070024
25 git branch side &&
26
27 git reset --hard HEAD^ &&
28 >elif &&
29 git add elif &&
30 test_tick &&
Gregory Herreroed5144d2018-02-08 21:42:41 +010031 git commit -m second &&
Junio C Hamano5e835ca2008-04-16 12:50:48 -070032
Gregory Herreroed5144d2018-02-08 21:42:41 +010033 git checkout -b side2 &&
34 >afile &&
35 git add afile &&
36 test_tick &&
37 git commit -m third &&
38 echo hello >afile &&
39 test_tick &&
40 git commit -a -m fourth &&
41 git checkout -b side-merge &&
42 git reset --hard HEAD^^ &&
43 git merge --no-ff -m "A merge commit log message that has a long
44summary that spills over multiple lines.
45
46But otherwise with a sane description." side2 &&
47 git branch side-merge-original
Junio C Hamano5e835ca2008-04-16 12:50:48 -070048'
49
50test_expect_success rebase '
51
52 git checkout side &&
Johannes Schindelind1c02d92020-11-18 23:44:25 +000053 git rebase main &&
Stephen Boyd9524cf22010-01-26 15:08:31 -080054 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
55 git cat-file commit side@{1} | sed -e "1,/^\$/d" >expect &&
Junio C Hamano5e835ca2008-04-16 12:50:48 -070056 test_cmp expect actual
57
58'
Junio C Hamano5e835ca2008-04-16 12:50:48 -070059test_done