3 test_description
='merging with large rename matrix'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 TEST_PASSES_SANITIZE_LEAK
=true
12 while test $i -le $1; do
18 test_expect_success
'setup (initial)' '
21 git commit -m initial &&
27 for i
in $
(count
20); do
34 test_expect_success
"rename ($1, $2)" '
37 git checkout -f main &&
38 test_might_fail git branch -D test$n &&
39 git reset --hard initial &&
40 for i in $(count $n); do
41 make_text $i initial initial >$i || return 1
44 git commit -m add=$n &&
45 for i in $(count $n); do
46 make_text $i changed initial >$i || return 1
48 git commit -a -m change=$n &&
49 git checkout -b test$n HEAD^ &&
50 for i in $(count $n); do
52 make_text $i initial changed >$i.moved || return 1
55 git commit -m change+rename=$n &&
58 *) test_must_fail git merge main ;;
65 test_expect_success
'set diff.renamelimit to 4' '
66 git config diff.renamelimit 4
71 test_expect_success
'set merge.renamelimit to 5' '
72 git config merge.renamelimit 5
77 test_expect_success
'setup large simple rename' '
78 git config --unset merge.renamelimit &&
79 git config --unset diff.renamelimit &&
81 git reset --hard initial &&
82 for i in $(count 200); do
83 make_text foo bar baz >$i || return 1
86 git commit -m create-files &&
88 git branch simple-change &&
89 git checkout -b simple-rename &&
92 git mv [0-9]* builtin/ &&
93 git commit -m renamed &&
95 git checkout simple-change &&
97 git add unrelated-change &&
98 git commit -m unrelated-change
101 test_expect_success
'massive simple rename does not spam added files' '
102 sane_unset GIT_MERGE_VERBOSITY &&
103 git merge --no-stat simple-rename | grep -v Removing >output &&
104 test_line_count -lt 5 output