transport-helper: update ref status after push with export
[git/mjg.git] / t / t7060-wtstatus.sh
blobb8cb4906aa7de022543b594399b6fa9a83ffc847
1 #!/bin/sh
3 test_description='basic work tree status reporting'
5 . ./test-lib.sh
7 test_expect_success setup '
8 test_commit A &&
9 test_commit B oneside added &&
10 git checkout A^0 &&
11 test_commit C oneside created
14 test_expect_success 'A/A conflict' '
15 git checkout B^0 &&
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
31 cat >expect <<EOF
32 # On branch side
33 # Unmerged paths:
34 # (use "git add/rm <file>..." as appropriate to mark resolution)
36 # deleted by us: foo
38 no changes added to commit (use "git add" and/or "git commit -a")
39 EOF
41 test_expect_success 'M/D conflict does not segfault' '
42 mkdir mdconflict &&
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_i18ncmp ../expect ../actual &&
54 git status >../actual &&
55 test_i18ncmp ../expect ../actual
59 test_expect_success 'rename & unmerged setup' '
60 git rm -f -r . &&
61 cat "$TEST_DIRECTORY/README" >ONE &&
62 git add ONE &&
63 test_tick &&
64 git commit -m "One commit with ONE" &&
66 echo Modified >TWO &&
67 cat ONE >>TWO &&
68 cat ONE >>THREE &&
69 git add TWO THREE &&
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 &&
77 echo Further >>THREE
80 test_expect_success 'rename & unmerged status' '
81 git status -suno >actual &&
82 cat >expect <<-EOF &&
83 UU ONE
84 AM THREE
85 A TWO
86 EOF
87 test_cmp expect actual
90 test_expect_success 'git diff-index --cached shows 2 added + 1 unmerged' '
91 cat >expected <<-EOF &&
92 U ONE
93 A THREE
94 A TWO
95 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 &&
102 U ONE
103 A THREE
104 A TWO
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 &&
112 U ONE
113 C ONE THREE
114 C ONE TWO
116 git diff-index --cached -C --name-status HEAD |
117 sed "s/^C[0-9]*/C/g" >actual &&
118 test_cmp expected actual
121 test_done