git/t/t7525-status-rename.sh
Junio C Hamano 6789275d37 tests: teach callers of test_i18ngrep to use test_grep
They are equivalents and the former still exists, so as long as the
only change this commit makes are to rewrite test_i18ngrep to
test_grep, there won't be any new bug, even if there still are
callers of test_i18ngrep remaining in the tree, or when merged to
other topics that add new uses of test_i18ngrep.

This patch was produced more or less with

    git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' |
    xargs perl -p -i -e 's/test_i18ngrep /test_grep /'

and a good way to sanity check the result yourself is to run the
above in a checkout of c4603c1c (test framework: further deprecate
test_i18ngrep, 2023-10-31) and compare the resulting working tree
contents with the result of applying this patch to the same commit.
You'll see that test_i18ngrep in a few t/lib-*.sh files corrected,
in addition to the manual reproduction.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02 17:13:44 +09:00

114 lines
2.8 KiB
Bash
Executable file

#!/bin/sh
test_description='git status rename detection options'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
echo 1 >original &&
git add . &&
git commit -m"Adding original file." &&
mv original renamed &&
echo 2 >> renamed &&
git add . &&
cat >.gitignore <<-\EOF
.gitignore
expect*
actual*
EOF
'
test_expect_success 'status no-options' '
git status >actual &&
test_grep "renamed:" actual
'
test_expect_success 'status --no-renames' '
git status --no-renames >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'status.renames inherits from diff.renames false' '
git -c diff.renames=false status >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'status.renames inherits from diff.renames true' '
git -c diff.renames=true status >actual &&
test_grep "renamed:" actual
'
test_expect_success 'status.renames overrides diff.renames false' '
git -c diff.renames=true -c status.renames=false status >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'status.renames overrides from diff.renames true' '
git -c diff.renames=false -c status.renames=true status >actual &&
test_grep "renamed:" actual
'
test_expect_success 'status status.renames=false' '
git -c status.renames=false status >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'status status.renames=true' '
git -c status.renames=true status >actual &&
test_grep "renamed:" actual
'
test_expect_success 'commit honors status.renames=false' '
git -c status.renames=false commit --dry-run >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'commit honors status.renames=true' '
git -c status.renames=true commit --dry-run >actual &&
test_grep "renamed:" actual
'
test_expect_success 'status config overridden' '
git -c status.renames=true status --no-renames >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'status score=100%' '
git status -M=100% >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual &&
git status --find-renames=100% >actual &&
test_grep "deleted:" actual &&
test_grep "new file:" actual
'
test_expect_success 'status score=01%' '
git status -M=01% >actual &&
test_grep "renamed:" actual &&
git status --find-renames=01% >actual &&
test_grep "renamed:" actual
'
test_expect_success 'copies not overridden by find-renames' '
cp renamed copy &&
git add copy &&
git -c status.renames=copies status -M=01% >actual &&
test_grep "copied:" actual &&
test_grep "renamed:" actual &&
git -c status.renames=copies status --find-renames=01% >actual &&
test_grep "copied:" actual &&
test_grep "renamed:" actual
'
test_done