]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7525-status-rename.sh
The third batch
[thirdparty/git.git] / t / t7525-status-rename.sh
1 #!/bin/sh
2
3 test_description='git status rename detection options'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 test_expect_success 'setup' '
9 echo 1 >original &&
10 git add . &&
11 git commit -m"Adding original file." &&
12 mv original renamed &&
13 echo 2 >> renamed &&
14 git add . &&
15 cat >.gitignore <<-\EOF
16 .gitignore
17 expect*
18 actual*
19 EOF
20 '
21
22 test_expect_success 'status no-options' '
23 git status >actual &&
24 test_grep "renamed:" actual
25 '
26
27 test_expect_success 'status --no-renames' '
28 git status --no-renames >actual &&
29 test_grep "deleted:" actual &&
30 test_grep "new file:" actual
31 '
32
33 test_expect_success 'status.renames inherits from diff.renames false' '
34 git -c diff.renames=false status >actual &&
35 test_grep "deleted:" actual &&
36 test_grep "new file:" actual
37 '
38
39 test_expect_success 'status.renames inherits from diff.renames true' '
40 git -c diff.renames=true status >actual &&
41 test_grep "renamed:" actual
42 '
43
44 test_expect_success 'status.renames overrides diff.renames false' '
45 git -c diff.renames=true -c status.renames=false status >actual &&
46 test_grep "deleted:" actual &&
47 test_grep "new file:" actual
48 '
49
50 test_expect_success 'status.renames overrides from diff.renames true' '
51 git -c diff.renames=false -c status.renames=true status >actual &&
52 test_grep "renamed:" actual
53 '
54
55 test_expect_success 'status status.renames=false' '
56 git -c status.renames=false status >actual &&
57 test_grep "deleted:" actual &&
58 test_grep "new file:" actual
59 '
60
61 test_expect_success 'status status.renames=true' '
62 git -c status.renames=true status >actual &&
63 test_grep "renamed:" actual
64 '
65
66 test_expect_success 'commit honors status.renames=false' '
67 git -c status.renames=false commit --dry-run >actual &&
68 test_grep "deleted:" actual &&
69 test_grep "new file:" actual
70 '
71
72 test_expect_success 'commit honors status.renames=true' '
73 git -c status.renames=true commit --dry-run >actual &&
74 test_grep "renamed:" actual
75 '
76
77 test_expect_success 'status config overridden' '
78 git -c status.renames=true status --no-renames >actual &&
79 test_grep "deleted:" actual &&
80 test_grep "new file:" actual
81 '
82
83 test_expect_success 'status score=100%' '
84 git status -M=100% >actual &&
85 test_grep "deleted:" actual &&
86 test_grep "new file:" actual &&
87
88 git status --find-renames=100% >actual &&
89 test_grep "deleted:" actual &&
90 test_grep "new file:" actual
91 '
92
93 test_expect_success 'status score=01%' '
94 git status -M=01% >actual &&
95 test_grep "renamed:" actual &&
96
97 git status --find-renames=01% >actual &&
98 test_grep "renamed:" actual
99 '
100
101 test_expect_success 'copies not overridden by find-renames' '
102 cp renamed copy &&
103 git add copy &&
104
105 git -c status.renames=copies status -M=01% >actual &&
106 test_grep "copied:" actual &&
107 test_grep "renamed:" actual &&
108
109 git -c status.renames=copies status --find-renames=01% >actual &&
110 test_grep "copied:" actual &&
111 test_grep "renamed:" actual
112 '
113
114 test_done