]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4066-diff-emit-delay.sh
The third batch
[thirdparty/git.git] / t / t4066-diff-emit-delay.sh
CommitLineData
48edf3a0
JK
1#!/bin/sh
2
3test_description='test combined/stat/moved interaction'
8f37854b 4GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
5export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
a52f07af 7TEST_PASSES_SANITIZE_LEAK=true
48edf3a0
JK
8. ./test-lib.sh
9
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.
14
15test_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 &&
8f37854b 20 git merge -m M main &&
48edf3a0
JK
21 test_commit D
22'
23
24test_expect_success 'log --cc -p --stat --color-moved' '
215b60bf 25 cat >expect <<-EOF &&
48edf3a0
JK
26 commit D
27 ---
28 D.t | 1 +
29 1 file changed, 1 insertion(+)
30
31 diff --git a/D.t b/D.t
32 new file mode 100644
215b60bf 33 index 0000000..$(git rev-parse --short D:D.t)
48edf3a0
JK
34 --- /dev/null
35 +++ b/D.t
36 @@ -0,0 +1 @@
37 +D
38 commit M
39
40 B.t | 1 +
41 1 file changed, 1 insertion(+)
42 commit C
43 ---
44 C.t | 1 +
45 1 file changed, 1 insertion(+)
46
47 diff --git a/C.t b/C.t
48 new file mode 100644
215b60bf 49 index 0000000..$(git rev-parse --short C:C.t)
48edf3a0
JK
50 --- /dev/null
51 +++ b/C.t
52 @@ -0,0 +1 @@
53 +C
54 commit B
55 ---
56 B.t | 1 +
57 1 file changed, 1 insertion(+)
58
59 diff --git a/B.t b/B.t
60 new file mode 100644
215b60bf 61 index 0000000..$(git rev-parse --short B:B.t)
48edf3a0
JK
62 --- /dev/null
63 +++ b/B.t
64 @@ -0,0 +1 @@
65 +B
66 commit A
67 ---
68 A.t | 1 +
69 1 file changed, 1 insertion(+)
70
71 diff --git a/A.t b/A.t
72 new file mode 100644
215b60bf 73 index 0000000..$(git rev-parse --short A:A.t)
48edf3a0
JK
74 --- /dev/null
75 +++ b/A.t
76 @@ -0,0 +1 @@
77 +A
78 EOF
79 git log --format="commit %s" --cc -p --stat --color-moved >actual &&
80 test_cmp expect actual
81'
82
83test_done