interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / t4206-log-follow-harder-copies.sh

89 lines · 1730 bytes Raw Blame History
1#!/bin/sh
2#
3# Copyright (c) 2010 Bo Yang
4#
5
6test_description='Test --follow should always find copies hard in git log.
7
8'
9
10. ./test-lib.sh
11. "$TEST_DIRECTORY"/lib-diff.sh
12
13echo >path0 'Line 1
14Line 2
15Line 3
16'
17
18test_expect_success 'add a file path0 and commit.' '
19 git add path0 &&
20 git commit -m "Add path0"
21'
22
23echo >path0 'New line 1
24New line 2
25New line 3
26'
27test_expect_success 'Change path0.' '
28 git add path0 &&
29 git commit -m "Change path0"
30'
31
32cat <path0 >path1
33test_expect_success 'copy path0 to path1.' '
34 git add path1 &&
35 git commit -m "Copy path1 from path0"
36'
37
38test_expect_success 'find the copy path0 -> path1 harder' '
39 git log --follow --name-status --pretty="format:%s" path1 > current
40'
41
42cat >expected <<\EOF
43Copy path1 from path0
44C100 path0 path1
45
46Change path0
47M path0
48
49Add path0
50A path0
51EOF
52
53test_expect_success 'validate the output.' '
54 compare_diff_patch current expected
55'
56
57test_expect_success 'log --follow -B does not BUG' '
58 git switch --orphan break_and_follow_are_icky_so_use_both &&
59
60 test_seq 1 127 >numbers &&
61 git add numbers &&
62 git commit -m "numbers" &&
63
64 printf "%s\n" A B C D E F G H I J K L M N O Q R S T U V W X Y Z >pool &&
65 echo changed >numbers &&
66 git add pool numbers &&
67 git commit -m "pool" &&
68
69 git log -1 -B --raw --follow -- "p*"
70'
71
72test_expect_success 'log --follow -B does not die or use uninitialized memory' '
73 printf "%s\n" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z >z &&
74 git add z &&
75 git commit -m "Initial" &&
76
77 test_seq 1 130 >z &&
78 echo lame >somefile &&
79 git add z somefile &&
80 git commit -m "Rewrite z, introduce lame somefile" &&
81
82 echo Content >somefile &&
83 git add somefile &&
84 git commit -m "Rewrite somefile" &&
85
86 git log -B --follow somefile
87'
88
89test_done