Revert "MinGW: Add missing file mode bit defines"
[git/mingw/4msysgit/gitPS1fix.git] / t / t6032-merge-large-rename.sh
blobfdb6c253718e3d4c8acfcd1fc197607aac04b4c4
1 #!/bin/sh
3 test_description='merging with large rename matrix'
4 . ./test-lib.sh
6 count() {
7 i=1
8 while test $i -le $1; do
9 echo $i
10 i=$(($i + 1))
11 done
14 test_expect_success 'setup (initial)' '
15 touch file &&
16 git add . &&
17 git commit -m initial &&
18 git tag initial
21 make_text() {
22 echo $1: $2
23 for i in `count 20`; do
24 echo $1: $i
25 done
26 echo $1: $3
29 test_rename() {
30 test_expect_success "rename ($1, $2)" '
31 n='$1'
32 expect='$2'
33 git checkout -f master &&
34 git branch -D test$n || true &&
35 git reset --hard initial &&
36 for i in $(count $n); do
37 make_text $i initial initial >$i
38 done &&
39 git add . &&
40 git commit -m add=$n &&
41 for i in $(count $n); do
42 make_text $i changed initial >$i
43 done &&
44 git commit -a -m change=$n &&
45 git checkout -b test$n HEAD^ &&
46 for i in $(count $n); do
47 git rm $i
48 make_text $i initial changed >$i.moved
49 done &&
50 git add . &&
51 git commit -m change+rename=$n &&
52 case "$expect" in
53 ok) git merge master ;;
54 *) test_must_fail git merge master ;;
55 esac
59 test_rename 5 ok
61 test_expect_success 'set diff.renamelimit to 4' '
62 git config diff.renamelimit 4
64 test_rename 4 ok
65 test_rename 5 fail
67 test_expect_success 'set merge.renamelimit to 5' '
68 git config merge.renamelimit 5
70 test_rename 5 ok
71 test_rename 6 fail
73 test_expect_success 'setup large simple rename' '
74 git config --unset merge.renamelimit &&
75 git config --unset diff.renamelimit &&
77 git reset --hard initial &&
78 for i in $(count 200); do
79 make_text foo bar baz >$i
80 done &&
81 git add . &&
82 git commit -m create-files &&
84 git branch simple-change &&
85 git checkout -b simple-rename &&
87 mkdir builtin &&
88 git mv [0-9]* builtin/ &&
89 git commit -m renamed &&
91 git checkout simple-change &&
92 >unrelated-change &&
93 git add unrelated-change &&
94 git commit -m unrelated-change
97 test_expect_success 'massive simple rename does not spam added files' '
98 unset GIT_MERGE_VERBOSITY &&
99 git merge --no-stat simple-rename | grep -v Removing >output &&
100 test 5 -gt "$(wc -l < output)"
103 test_done