1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
56
test_description='Test rename detection in diff engine.
78
'
9. ./test-lib.sh
1011
echo >path0 'Line 1
12Line 2
13Line 3
14Line 4
15Line 5
16Line 6
17Line 7
18Line 8
19Line 9
20Line 10
21line 11
22Line 12
23Line 13
24Line 14
25Line 15
26'
2728
test_expect_success \
29'update-cache --add a file.' \
30'git-update-cache --add path0'
3132
test_expect_success \
33'write that tree.' \
34'tree=$(git-write-tree)'
3536
sed -e 's/line/Line/' <path0 >path1
37rm -f path0
38test_expect_success \
39'renamed and edited the file.' \
40'git-update-cache --add --remove path0 path1'
4142
test_expect_success \
43'git-diff-cache -p -M after rename and editing.' \
44'git-diff-cache -p -M $tree >current'
45cat >expected <<\EOF
46diff --git a/path0 b/path1
47rename old path0
48rename new path1
49--- a/path0
50+++ b/path1
51@@ -8,7 +8,7 @@ Line 7
52Line 8
53Line 9
54Line 10
55-line 11
56+Line 11
57Line 12
58Line 13
59Line 14
60EOF
6162
test_expect_success \
63'validate the output.' \
64'diff -I "rename similarity.*" >/dev/null current expected'
6566
test_done