Code

Merge branch 'maint'
[git.git] / t / t7060-wtstatus.sh
index fcac4725982096af98414c5d40df2d4c14be9454..b8cb4906aa7de022543b594399b6fa9a83ffc847 100755 (executable)
@@ -50,10 +50,72 @@ test_expect_success 'M/D conflict does not segfault' '
                git commit -m delete &&
                test_must_fail git merge master &&
                test_must_fail git commit --dry-run >../actual &&
-               test_cmp ../expect ../actual &&
+               test_i18ncmp ../expect ../actual &&
                git status >../actual &&
-               test_cmp ../expect ../actual
+               test_i18ncmp ../expect ../actual
        )
 '
 
+test_expect_success 'rename & unmerged setup' '
+       git rm -f -r . &&
+       cat "$TEST_DIRECTORY/README" >ONE &&
+       git add ONE &&
+       test_tick &&
+       git commit -m "One commit with ONE" &&
+
+       echo Modified >TWO &&
+       cat ONE >>TWO &&
+       cat ONE >>THREE &&
+       git add TWO THREE &&
+       sha1=$(git rev-parse :ONE) &&
+       git rm --cached ONE &&
+       (
+               echo "100644 $sha1 1    ONE" &&
+               echo "100644 $sha1 2    ONE" &&
+               echo "100644 $sha1 3    ONE"
+       ) | git update-index --index-info &&
+       echo Further >>THREE
+'
+
+test_expect_success 'rename & unmerged status' '
+       git status -suno >actual &&
+       cat >expect <<-EOF &&
+       UU ONE
+       AM THREE
+       A  TWO
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'git diff-index --cached shows 2 added + 1 unmerged' '
+       cat >expected <<-EOF &&
+       U       ONE
+       A       THREE
+       A       TWO
+       EOF
+       git diff-index --cached --name-status HEAD >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'git diff-index --cached -M shows 2 added + 1 unmerged' '
+       cat >expected <<-EOF &&
+       U       ONE
+       A       THREE
+       A       TWO
+       EOF
+       git diff-index --cached --name-status HEAD >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'git diff-index --cached -C shows 2 copies + 1 unmerged' '
+       cat >expected <<-EOF &&
+       U       ONE
+       C       ONE     THREE
+       C       ONE     TWO
+       EOF
+       git diff-index --cached -C --name-status HEAD |
+       sed "s/^C[0-9]*/C/g" >actual &&
+       test_cmp expected actual
+'
+
 test_done