]> git.ipfire.org Git - thirdparty/git.git/blame - t/t7525-status-rename.sh
Merge branch 'es/add-doc-list-short-form-of-all-in-synopsis'
[thirdparty/git.git] / t / t7525-status-rename.sh
CommitLineData
e8b2dc2c
BP
1#!/bin/sh
2
3test_description='git status rename detection options'
4
d96fb140 5TEST_PASSES_SANITIZE_LEAK=true
e8b2dc2c
BP
6. ./test-lib.sh
7
8test_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
22test_expect_success 'status no-options' '
23 git status >actual &&
6789275d 24 test_grep "renamed:" actual
e8b2dc2c
BP
25'
26
27test_expect_success 'status --no-renames' '
28 git status --no-renames >actual &&
6789275d
JH
29 test_grep "deleted:" actual &&
30 test_grep "new file:" actual
e8b2dc2c
BP
31'
32
33test_expect_success 'status.renames inherits from diff.renames false' '
34 git -c diff.renames=false status >actual &&
6789275d
JH
35 test_grep "deleted:" actual &&
36 test_grep "new file:" actual
e8b2dc2c
BP
37'
38
39test_expect_success 'status.renames inherits from diff.renames true' '
40 git -c diff.renames=true status >actual &&
6789275d 41 test_grep "renamed:" actual
e8b2dc2c
BP
42'
43
44test_expect_success 'status.renames overrides diff.renames false' '
45 git -c diff.renames=true -c status.renames=false status >actual &&
6789275d
JH
46 test_grep "deleted:" actual &&
47 test_grep "new file:" actual
e8b2dc2c
BP
48'
49
50test_expect_success 'status.renames overrides from diff.renames true' '
51 git -c diff.renames=false -c status.renames=true status >actual &&
6789275d 52 test_grep "renamed:" actual
e8b2dc2c
BP
53'
54
55test_expect_success 'status status.renames=false' '
56 git -c status.renames=false status >actual &&
6789275d
JH
57 test_grep "deleted:" actual &&
58 test_grep "new file:" actual
e8b2dc2c
BP
59'
60
61test_expect_success 'status status.renames=true' '
62 git -c status.renames=true status >actual &&
6789275d 63 test_grep "renamed:" actual
e8b2dc2c
BP
64'
65
66test_expect_success 'commit honors status.renames=false' '
67 git -c status.renames=false commit --dry-run >actual &&
6789275d
JH
68 test_grep "deleted:" actual &&
69 test_grep "new file:" actual
e8b2dc2c
BP
70'
71
72test_expect_success 'commit honors status.renames=true' '
73 git -c status.renames=true commit --dry-run >actual &&
6789275d 74 test_grep "renamed:" actual
e8b2dc2c
BP
75'
76
77test_expect_success 'status config overridden' '
78 git -c status.renames=true status --no-renames >actual &&
6789275d
JH
79 test_grep "deleted:" actual &&
80 test_grep "new file:" actual
e8b2dc2c
BP
81'
82
83test_expect_success 'status score=100%' '
84 git status -M=100% >actual &&
6789275d
JH
85 test_grep "deleted:" actual &&
86 test_grep "new file:" actual &&
e8b2dc2c 87
c4932b00 88 git status --find-renames=100% >actual &&
6789275d
JH
89 test_grep "deleted:" actual &&
90 test_grep "new file:" actual
e8b2dc2c
BP
91'
92
93test_expect_success 'status score=01%' '
94 git status -M=01% >actual &&
6789275d 95 test_grep "renamed:" actual &&
e8b2dc2c 96
c4932b00 97 git status --find-renames=01% >actual &&
6789275d 98 test_grep "renamed:" actual
e8b2dc2c
BP
99'
100
c4932b00 101test_expect_success 'copies not overridden by find-renames' '
e8b2dc2c
BP
102 cp renamed copy &&
103 git add copy &&
104
105 git -c status.renames=copies status -M=01% >actual &&
6789275d
JH
106 test_grep "copied:" actual &&
107 test_grep "renamed:" actual &&
e8b2dc2c 108
c4932b00 109 git -c status.renames=copies status --find-renames=01% >actual &&
6789275d
JH
110 test_grep "copied:" actual &&
111 test_grep "renamed:" actual
e8b2dc2c
BP
112'
113
114test_done