mirror of
https://github.com/git/git
synced 2024-10-30 03:13:24 +00:00
e8b2dc2c2a
After performing a merge that has conflicts git status will, by default, attempt to detect renames which causes many objects to be examined. In a virtualized repo, those objects do not exist locally so the rename logic triggers them to be fetched from the server. This results in the status call taking hours to complete on very large repos vs seconds with this patch. Add a new config status.renames setting to enable turning off rename detection during status and commit. This setting will default to the value of diff.renames. Add a new config status.renamelimit setting to to enable bounding the time spent finding out inexact renames during status and commit. This setting will default to the value of diff.renamelimit. Add --no-renames command line option to status that enables overriding the config setting from the command line. Add --find-renames[=<n>] command line option to status that enables detecting renames and optionally setting the similarity index. Reviewed-by: Elijah Newren <newren@gmail.com> Original-Patch-by: Alejandro Pauly <alpauly@microsoft.com> Signed-off-by: Ben Peart <Ben.Peart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
113 lines
2.9 KiB
Bash
Executable file
113 lines
2.9 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='git status rename detection options'
|
|
|
|
. ./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_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_expect_success 'status --no-renames' '
|
|
git status --no-renames >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual
|
|
'
|
|
|
|
test_expect_success 'status.renames inherits from diff.renames false' '
|
|
git -c diff.renames=false status >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual
|
|
'
|
|
|
|
test_expect_success 'status.renames inherits from diff.renames true' '
|
|
git -c diff.renames=true status >actual &&
|
|
test_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_expect_success 'status.renames overrides diff.renames false' '
|
|
git -c diff.renames=true -c status.renames=false status >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "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_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_expect_success 'status status.renames=false' '
|
|
git -c status.renames=false status >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual
|
|
'
|
|
|
|
test_expect_success 'status status.renames=true' '
|
|
git -c status.renames=true status >actual &&
|
|
test_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_expect_success 'commit honors status.renames=false' '
|
|
git -c status.renames=false commit --dry-run >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual
|
|
'
|
|
|
|
test_expect_success 'commit honors status.renames=true' '
|
|
git -c status.renames=true commit --dry-run >actual &&
|
|
test_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_expect_success 'status config overridden' '
|
|
git -c status.renames=true status --no-renames >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual
|
|
'
|
|
|
|
test_expect_success 'status score=100%' '
|
|
git status -M=100% >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual &&
|
|
|
|
git status --find-rename=100% >actual &&
|
|
test_i18ngrep "deleted:" actual &&
|
|
test_i18ngrep "new file:" actual
|
|
'
|
|
|
|
test_expect_success 'status score=01%' '
|
|
git status -M=01% >actual &&
|
|
test_i18ngrep "renamed:" actual &&
|
|
|
|
git status --find-rename=01% >actual &&
|
|
test_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_expect_success 'copies not overridden by find-rename' '
|
|
cp renamed copy &&
|
|
git add copy &&
|
|
|
|
git -c status.renames=copies status -M=01% >actual &&
|
|
test_i18ngrep "copied:" actual &&
|
|
test_i18ngrep "renamed:" actual &&
|
|
|
|
git -c status.renames=copies status --find-rename=01% >actual &&
|
|
test_i18ngrep "copied:" actual &&
|
|
test_i18ngrep "renamed:" actual
|
|
'
|
|
|
|
test_done
|