cocci: apply "pending" index-compatibility to "t/helper/*.c"
[git/debian.git] / t / t4066-diff-emit-delay.sh
blob0ecb3915412fcd70a62dc9acfba3054240767177
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_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
10 # This test covers a weird 3-way interaction between "--cc -p", which will run
11 # the combined diff code, along with "--stat", which will be computed as a
12 # first-parent stat during the combined diff, and "--color-moved", which
13 # enables the emitted_symbols list to store the diff in memory.
15 test_expect_success 'set up history with a merge' '
16 test_commit A &&
17 test_commit B &&
18 git checkout -b side HEAD^ &&
19 test_commit C &&
20 git merge -m M main &&
21 test_commit D
24 test_expect_success 'log --cc -p --stat --color-moved' '
25 cat >expect <<-EOF &&
26 commit D
27 ---
28 D.t | 1 +
29 1 file changed, 1 insertion(+)
31 diff --git a/D.t b/D.t
32 new file mode 100644
33 index 0000000..$(git rev-parse --short D:D.t)
34 --- /dev/null
35 +++ b/D.t
36 @@ -0,0 +1 @@
38 commit M
40 B.t | 1 +
41 1 file changed, 1 insertion(+)
42 commit C
43 ---
44 C.t | 1 +
45 1 file changed, 1 insertion(+)
47 diff --git a/C.t b/C.t
48 new file mode 100644
49 index 0000000..$(git rev-parse --short C:C.t)
50 --- /dev/null
51 +++ b/C.t
52 @@ -0,0 +1 @@
54 commit B
55 ---
56 B.t | 1 +
57 1 file changed, 1 insertion(+)
59 diff --git a/B.t b/B.t
60 new file mode 100644
61 index 0000000..$(git rev-parse --short B:B.t)
62 --- /dev/null
63 +++ b/B.t
64 @@ -0,0 +1 @@
66 commit A
67 ---
68 A.t | 1 +
69 1 file changed, 1 insertion(+)
71 diff --git a/A.t b/A.t
72 new file mode 100644
73 index 0000000..$(git rev-parse --short A:A.t)
74 --- /dev/null
75 +++ b/A.t
76 @@ -0,0 +1 @@
78 EOF
79 git log --format="commit %s" --cc -p --stat --color-moved >actual &&
80 test_cmp expect actual
83 test_done