add tests for cloning corrupted repositories
[git/jrn.git] / t / t4206-log-follow-harder-copies.sh
blobad29e65fcba6be9a6b27954d5dcda7efe31d3018
1 #!/bin/sh
3 # Copyright (c) 2010 Bo Yang
6 test_description='Test --follow should always find copies hard in git log.
9 . ./test-lib.sh
10 . "$TEST_DIRECTORY"/diff-lib.sh
12 echo >path0 'Line 1
13 Line 2
14 Line 3
17 test_expect_success \
18 'add a file path0 and commit.' \
19 'git add path0 &&
20 git commit -m "Add path0"'
22 echo >path0 'New line 1
23 New line 2
24 New line 3
26 test_expect_success \
27 'Change path0.' \
28 'git add path0 &&
29 git commit -m "Change path0"'
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"'
37 test_expect_success \
38 'find the copy path0 -> path1 harder' \
39 'git log --follow --name-status --pretty="format:%s" path1 > current'
41 cat >expected <<\EOF
42 Copy path1 from path0
43 C100 path0 path1
45 Change path0
46 M path0
48 Add path0
49 A path0
50 EOF
52 test_expect_success \
53 'validate the output.' \
54 'compare_diff_patch current expected'
56 test_done