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