rebase: use correct base for --keep-base when a branch is given
[alt-git.git] / t / t4066-diff-emit-delay.sh
bloba1de63b77f8b41ba0513f626d196129cf3ea4f09
1 #!/bin/sh
3 test_description='test combined/stat/moved interaction'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
9 # This test covers a weird 3-way interaction between "--cc -p", which will run
10 # the combined diff code, along with "--stat", which will be computed as a
11 # first-parent stat during the combined diff, and "--color-moved", which
12 # enables the emitted_symbols list to store the diff in memory.
14 test_expect_success 'set up history with a merge' '
15 test_commit A &&
16 test_commit B &&
17 git checkout -b side HEAD^ &&
18 test_commit C &&
19 git merge -m M main &&
20 test_commit D
23 test_expect_success 'log --cc -p --stat --color-moved' '
24 cat >expect <<-EOF &&
25 commit D
26 ---
27 D.t | 1 +
28 1 file changed, 1 insertion(+)
30 diff --git a/D.t b/D.t
31 new file mode 100644
32 index 0000000..$(git rev-parse --short D:D.t)
33 --- /dev/null
34 +++ b/D.t
35 @@ -0,0 +1 @@
37 commit M
39 B.t | 1 +
40 1 file changed, 1 insertion(+)
41 commit C
42 ---
43 C.t | 1 +
44 1 file changed, 1 insertion(+)
46 diff --git a/C.t b/C.t
47 new file mode 100644
48 index 0000000..$(git rev-parse --short C:C.t)
49 --- /dev/null
50 +++ b/C.t
51 @@ -0,0 +1 @@
53 commit B
54 ---
55 B.t | 1 +
56 1 file changed, 1 insertion(+)
58 diff --git a/B.t b/B.t
59 new file mode 100644
60 index 0000000..$(git rev-parse --short B:B.t)
61 --- /dev/null
62 +++ b/B.t
63 @@ -0,0 +1 @@
65 commit A
66 ---
67 A.t | 1 +
68 1 file changed, 1 insertion(+)
70 diff --git a/A.t b/A.t
71 new file mode 100644
72 index 0000000..$(git rev-parse --short A:A.t)
73 --- /dev/null
74 +++ b/A.t
75 @@ -0,0 +1 @@
77 EOF
78 git log --format="commit %s" --cc -p --stat --color-moved >actual &&
79 test_cmp expect actual
82 test_done