1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-14 21:23:03 +01:00
git/t/t7060-wtstatus.sh
Junio C Hamano a75c3523d3 Merge branch 'ab/i18n-fixup'
* ab/i18n-fixup: (24 commits)
  i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811
  i18n: use test_i18n{grep,cmp} in t7508
  i18n: use test_i18ngrep in t7506
  i18n: use test_i18ngrep and test_i18ncmp in t7502
  i18n: use test_i18ngrep in t7501
  i18n: use test_i18ncmp in t7500
  i18n: use test_i18ngrep in t7201
  i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110
  i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060
  i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014
  i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507
  i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200
  i18n: use test_i18ngrep in lib-httpd and t2019
  i18n: do not overuse C_LOCALE_OUTPUT (grep)
  i18n: use test_i18ncmp in t1200 and t2200
  i18n: .git file is not a human readable message (t5601)
  i18n: do not overuse C_LOCALE_OUTPUT
  i18n: mark init-db messages for translation
  i18n: mark checkout plural warning for translation
  i18n: mark checkout --detach messages for translation
  ...
2011-05-02 15:58:40 -07:00

121 lines
2.5 KiB
Bash
Executable file

#!/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 '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_i18ncmp ../expect ../actual &&
git status >../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