summaryrefslogtreecommitdiffstats
path: root/t/t3012-ls-files-dedup.sh
blob: 190e2f6eed758229579a85118106e80d05c8d7d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh

test_description='git ls-files --deduplicate test'

TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh

test_expect_success 'setup' '
	>a.txt &&
	>b.txt &&
	>delete.txt &&
	git add a.txt b.txt delete.txt &&
	git commit -m base &&
	echo a >a.txt &&
	echo b >b.txt &&
	echo delete >delete.txt &&
	git add a.txt b.txt delete.txt &&
	git commit -m tip &&
	git tag tip &&
	git reset --hard HEAD^ &&
	echo change >a.txt &&
	git commit -a -m side &&
	git tag side
'

test_expect_success 'git ls-files --deduplicate to show unique unmerged path' '
	test_must_fail git merge tip &&
	git ls-files --deduplicate >actual &&
	cat >expect <<-\EOF &&
	a.txt
	b.txt
	delete.txt
	EOF
	test_cmp expect actual &&
	git merge --abort
'

test_expect_success 'git ls-files -d -m --deduplicate with different display options' '
	git reset --hard side &&
	test_must_fail git merge tip &&
	rm delete.txt &&
	git ls-files -d -m --deduplicate >actual &&
	cat >expect <<-\EOF &&
	a.txt
	delete.txt
	EOF
	test_cmp expect actual &&
	git ls-files -d -m -t --deduplicate >actual &&
	cat >expect <<-\EOF &&
	C a.txt
	C a.txt
	C a.txt
	R delete.txt
	C delete.txt
	EOF
	test_cmp expect actual &&
	git ls-files -d -m -c --deduplicate >actual &&
	cat >expect <<-\EOF &&
	a.txt
	b.txt
	delete.txt
	EOF
	test_cmp expect actual &&
	git merge --abort
'

test_done