aboutsummaryrefslogtreecommitdiff
path: root/t/t7060-wtstatus.sh
blob: b4fcc86a10f15178da25da159e160b38d717f318 (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
#!/bin/sh

test_description='basic work tree status reporting'

. ./test-lib.sh

test_expect_success setup '
	test_commit A &&
	test_commit B oneside added &&
	git checkout A^0 &&
	test_commit C oneside created
'

test_expect_success 'A/A conflict' '
	git checkout B^0 &&
	test_must_fail git merge C
'

test_expect_success 'Report path with conflict' '
	git diff --cached --name-status >actual &&
	echo "U	oneside" >expect &&
	test_cmp expect actual
'

test_expect_success 'Report new path with conflict' '
	git diff --cached --name-status HEAD^ >actual &&
	echo "U	oneside" >expect &&
	test_cmp expect actual
'

cat >expect <<EOF
# On branch side
# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#	deleted by us:      foo
#
no changes added to commit (use "git add" and/or "git commit -a")
EOF

test_expect_success C_LOCALE_OUTPUT 'M/D conflict does not segfault' '
	mkdir mdconflict &&
	(
		cd mdconflict &&
		git init &&
		test_commit initial foo "" &&
		test_commit modify foo foo &&
		git checkout -b side HEAD^ &&
		git rm foo &&
		git commit -m delete &&
		test_must_fail git merge master &&
		test_must_fail git commit --dry-run >../actual &&
		test_cmp ../expect ../actual &&
		git status >../actual &&
		test_cmp ../expect ../actual
	)
'

test_done