diff.c: convert show_stats to use emit_diff_symbol
[git.git] / t / t4130-apply-criss-cross-rename.sh
blobf8a313bcb98c6e2b98982295773bdc8ac7e13256
1 #!/bin/sh
3 test_description='git apply handling criss-cross rename patch.'
4 . ./test-lib.sh
6 create_file() {
7 cnt=0
8 while test $cnt -le 100
9 do
10 cnt=$(($cnt + 1))
11 echo "$2" >> "$1"
12 done
15 test_expect_success 'setup' '
16 # Ensure that file sizes are different, because on Windows
17 # lstat() does not discover inode numbers, and we need
18 # other properties to discover swapped files
19 # (mtime is not always different, either).
20 create_file file1 "some content" &&
21 create_file file2 "some other content" &&
22 create_file file3 "again something else" &&
23 git add file1 file2 file3 &&
24 git commit -m 1
27 test_expect_success 'criss-cross rename' '
28 mv file1 tmp &&
29 mv file2 file1 &&
30 mv tmp file2 &&
31 cp file1 file1-swapped &&
32 cp file2 file2-swapped
35 test_expect_success 'diff -M -B' '
36 git diff -M -B > diff &&
37 git reset --hard
41 test_expect_success 'apply' '
42 git apply diff &&
43 test_cmp file1 file1-swapped &&
44 test_cmp file2 file2-swapped
47 test_expect_success 'criss-cross rename' '
48 git reset --hard &&
49 mv file1 tmp &&
50 mv file2 file1 &&
51 mv file3 file2 &&
52 mv tmp file3 &&
53 cp file1 file1-swapped &&
54 cp file2 file2-swapped &&
55 cp file3 file3-swapped
58 test_expect_success 'diff -M -B' '
59 git diff -M -B > diff &&
60 git reset --hard
63 test_expect_success 'apply' '
64 git apply diff &&
65 test_cmp file1 file1-swapped &&
66 test_cmp file2 file2-swapped &&
67 test_cmp file3 file3-swapped
70 test_done