]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3012-ls-files-dedup.sh
The third batch
[thirdparty/git.git] / t / t3012-ls-files-dedup.sh
1 #!/bin/sh
2
3 test_description='git ls-files --deduplicate test'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success 'setup' '
9 >a.txt &&
10 >b.txt &&
11 >delete.txt &&
12 git add a.txt b.txt delete.txt &&
13 git commit -m base &&
14 echo a >a.txt &&
15 echo b >b.txt &&
16 echo delete >delete.txt &&
17 git add a.txt b.txt delete.txt &&
18 git commit -m tip &&
19 git tag tip &&
20 git reset --hard HEAD^ &&
21 echo change >a.txt &&
22 git commit -a -m side &&
23 git tag side
24 '
25
26 test_expect_success 'git ls-files --deduplicate to show unique unmerged path' '
27 test_must_fail git merge tip &&
28 git ls-files --deduplicate >actual &&
29 cat >expect <<-\EOF &&
30 a.txt
31 b.txt
32 delete.txt
33 EOF
34 test_cmp expect actual &&
35 git merge --abort
36 '
37
38 test_expect_success 'git ls-files -d -m --deduplicate with different display options' '
39 git reset --hard side &&
40 test_must_fail git merge tip &&
41 rm delete.txt &&
42 git ls-files -d -m --deduplicate >actual &&
43 cat >expect <<-\EOF &&
44 a.txt
45 delete.txt
46 EOF
47 test_cmp expect actual &&
48 git ls-files -d -m -t --deduplicate >actual &&
49 cat >expect <<-\EOF &&
50 C a.txt
51 C a.txt
52 C a.txt
53 R delete.txt
54 C delete.txt
55 EOF
56 test_cmp expect actual &&
57 git ls-files -d -m -c --deduplicate >actual &&
58 cat >expect <<-\EOF &&
59 a.txt
60 b.txt
61 delete.txt
62 EOF
63 test_cmp expect actual &&
64 git merge --abort
65 '
66
67 test_done