Merge branch 'bp/fsmonitor' into next
[git] / t / t4206-log-follow-harder-copies.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2010 Bo Yang
4 #
5
6 test_description='Test --follow should always find copies hard in git log.
7
8 '
9 . ./test-lib.sh
10 . "$TEST_DIRECTORY"/diff-lib.sh
11
12 echo >path0 'Line 1
13 Line 2
14 Line 3
15 '
16
17 test_expect_success \
18     'add a file path0 and commit.' \
19     'git add path0 &&
20      git commit -m "Add path0"'
21
22 echo >path0 'New line 1
23 New line 2
24 New line 3
25 '
26 test_expect_success \
27     'Change path0.' \
28     'git add path0 &&
29      git commit -m "Change path0"'
30
31 cat <path0 >path1
32 test_expect_success \
33     'copy path0 to path1.' \
34     'git add path1 &&
35      git commit -m "Copy path1 from path0"'
36
37 test_expect_success \
38     'find the copy path0 -> path1 harder' \
39     'git log --follow --name-status --pretty="format:%s"  path1 > current'
40
41 cat >expected <<\EOF
42 Copy path1 from path0
43 C100    path0   path1
44
45 Change path0
46 M       path0
47
48 Add path0
49 A       path0
50 EOF
51
52 test_expect_success \
53     'validate the output.' \
54     'compare_diff_patch current expected'
55
56 test_done