1#!/bin/sh
23
test_description='merging with large rename matrix'
4. ./test-lib.sh
56
count() {
7i=1
8while test $i -le $1; do
9echo $i
10i=$(($i + 1))
11done
12}
1314
test_expect_success 'setup (initial)' '
15touch file &&
16git add . &&
17git commit -m initial &&
18git tag initial
19'
2021
make_text() {
22echo $1: $2
23for i in `count 20`; do
24echo $1: $i
25done
26echo $1: $3
27}
2829
test_rename() {
30test_expect_success "rename ($1, $2)" '
31n='$1'
32expect='$2'
33git checkout -f master &&
34git branch -D test$n || true &&
35git reset --hard initial &&
36for i in $(count $n); do
37make_text $i initial initial >$i
38done &&
39git add . &&
40git commit -m add=$n &&
41for i in $(count $n); do
42make_text $i changed initial >$i
43done &&
44git commit -a -m change=$n &&
45git checkout -b test$n HEAD^ &&
46for i in $(count $n); do
47git rm $i
48make_text $i initial changed >$i.moved
49done &&
50git add . &&
51git commit -m change+rename=$n &&
52case "$expect" in
53ok) git merge master ;;
54*) test_must_fail git merge master ;;
55esac
56'
57}
5859
test_rename 5 ok
6061
test_expect_success 'set diff.renamelimit to 4' '
62git config diff.renamelimit 4
63'
64test_rename 4 ok
65test_rename 5 fail
6667
test_expect_success 'set merge.renamelimit to 5' '
68git config merge.renamelimit 5
69'
70test_rename 5 ok
71test_rename 6 fail
7273
test_done