]> git.ipfire.org Git - thirdparty/git.git/blob - t/t4206-log-follow-harder-copies.sh
Sync with 2.36.3
[thirdparty/git.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
10 TEST_PASSES_SANITIZE_LEAK=true
11 . ./test-lib.sh
12 . "$TEST_DIRECTORY"/lib-diff.sh
13
14 echo >path0 'Line 1
15 Line 2
16 Line 3
17 '
18
19 test_expect_success \
20 'add a file path0 and commit.' \
21 'git add path0 &&
22 git commit -m "Add path0"'
23
24 echo >path0 'New line 1
25 New line 2
26 New line 3
27 '
28 test_expect_success \
29 'Change path0.' \
30 'git add path0 &&
31 git commit -m "Change path0"'
32
33 cat <path0 >path1
34 test_expect_success \
35 'copy path0 to path1.' \
36 'git add path1 &&
37 git commit -m "Copy path1 from path0"'
38
39 test_expect_success \
40 'find the copy path0 -> path1 harder' \
41 'git log --follow --name-status --pretty="format:%s" path1 > current'
42
43 cat >expected <<\EOF
44 Copy path1 from path0
45 C100 path0 path1
46
47 Change path0
48 M path0
49
50 Add path0
51 A path0
52 EOF
53
54 test_expect_success \
55 'validate the output.' \
56 'compare_diff_patch current expected'
57
58 test_done