3 test_description
='basic work tree status reporting'
7 test_expect_success setup
'
9 test_commit B oneside added &&
11 test_commit C oneside created
14 test_expect_success
'A/A conflict' '
16 test_must_fail git merge C
19 test_expect_success
'Report path with conflict' '
20 git diff --cached --name-status >actual &&
21 echo "U oneside" >expect &&
22 test_cmp expect actual
25 test_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
34 # (use "git add/rm <file>..." as appropriate to mark resolution)
38 no changes added to commit (use "git add" and/or "git commit -a")
41 test_expect_success
'M/D conflict does not segfault' '
46 test_commit initial foo "" &&
47 test_commit modify foo foo &&
48 git checkout -b side HEAD^ &&
50 git commit -m delete &&
51 test_must_fail git merge master &&
52 test_must_fail git commit --dry-run >../actual &&
53 test_i18ncmp ../expect ../actual &&
54 git status >../actual &&
55 test_i18ncmp ../expect ../actual
59 test_expect_success
'rename & unmerged setup' '
61 cat "$TEST_DIRECTORY/README" >ONE &&
64 git commit -m "One commit with ONE" &&
70 sha1=$(git rev-parse :ONE) &&
71 git rm --cached ONE &&
73 echo "100644 $sha1 1 ONE" &&
74 echo "100644 $sha1 2 ONE" &&
75 echo "100644 $sha1 3 ONE"
76 ) | git update-index --index-info &&
80 test_expect_success
'rename & unmerged status' '
81 git status -suno >actual &&
87 test_cmp expect actual
90 test_expect_success
'git diff-index --cached shows 2 added + 1 unmerged' '
91 cat >expected <<-EOF &&
96 git diff-index --cached --name-status HEAD >actual &&
97 test_cmp expected actual
100 test_expect_success
'git diff-index --cached -M shows 2 added + 1 unmerged' '
101 cat >expected <<-EOF &&
106 git diff-index --cached --name-status HEAD >actual &&
107 test_cmp expected actual
110 test_expect_success
'git diff-index --cached -C shows 2 copies + 1 unmerged' '
111 cat >expected <<-EOF &&
116 git diff-index --cached -C --name-status HEAD |
117 sed "s/^C[0-9]*/C/g" >actual &&
118 test_cmp expected actual