1#!/bin/sh
2
3test_description='basic work tree status reporting'
4
5. ./test-lib.sh
6
7test_expect_success setup '
8 test_commit A &&
9 test_commit B oneside added &&
10 git checkout A^0 &&
11 test_commit C oneside created
12'
13
14test_expect_success 'A/A conflict' '
15 git checkout B^0 &&
16 test_must_fail git merge C
17'
18
19test_expect_success 'Report path with conflict' '
20 git diff --cached --name-status >actual &&
21 echo "U oneside" >expect &&
22 test_cmp expect actual
23'
24
25test_expect_success 'Report new path with conflict' '
26 git diff --cached --name-status HEAD^ >actual &&
27 echo "U oneside" >expect &&
28 test_cmp expect actual
29'
30
31cat >expect <<EOF
32# On branch side
33# Unmerged paths:
34# (use "git add/rm <file>..." as appropriate to mark resolution)
35#
36# deleted by us: foo
37#
38no changes added to commit (use "git add" and/or "git commit -a")
39EOF
40
41test_expect_success 'M/D conflict does not segfault' '
42 mkdir mdconflict &&
43 (
44 cd mdconflict &&
45 git init &&
46 test_commit initial foo "" &&
47 test_commit modify foo foo &&
48 git checkout -b side HEAD^ &&
49 git rm foo &&
50 git commit -m delete &&
51 test_must_fail git merge master &&
52 test_must_fail git commit --dry-run >../actual &&
53 test_cmp ../expect ../actual &&
54 git status >../actual &&
55 test_cmp ../expect ../actual
56 )
57'
58
59test_done