Skip to content

Commit 1d49f0d

Browse files
mkiedrowiczgitster
authored andcommitted
tests: test applying criss-cross rename patch
Originally reported by Linus in $gmane/116198 Signed-off-by: Michał Kiedrowicz <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1f9b620 commit 1d49f0d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

t/t4130-apply-criss-cross-rename.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
3+
test_description='git apply handling criss-cross rename patch.'
4+
. ./test-lib.sh
5+
6+
create_file() {
7+
cnt=0
8+
while test $cnt -le 100
9+
do
10+
cnt=$(($cnt + 1))
11+
echo "$2" >> "$1"
12+
done
13+
}
14+
15+
test_expect_success 'setup' '
16+
create_file file1 "File1 contents" &&
17+
create_file file2 "File2 contents" &&
18+
git add file1 file2 &&
19+
git commit -m 1
20+
'
21+
22+
test_expect_success 'criss-cross rename' '
23+
mv file1 tmp &&
24+
mv file2 file1 &&
25+
mv tmp file2
26+
'
27+
28+
test_expect_success 'diff -M -B' '
29+
git diff -M -B > diff &&
30+
git reset --hard
31+
32+
'
33+
34+
test_expect_failure 'apply' '
35+
git apply diff
36+
'
37+
38+
test_done

0 commit comments

Comments
 (0)