The eleventh batch
[git/gitster.git] / t / t7525-status-rename.sh
bloba9210d3a3a92213728a32599defe664e1def0ffe
1 #!/bin/sh
3 test_description='git status rename detection options'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
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
22 test_expect_success 'status no-options' '
23 git status >actual &&
24 test_grep "renamed:" actual
27 test_expect_success 'status --no-renames' '
28 git status --no-renames >actual &&
29 test_grep "deleted:" actual &&
30 test_grep "new file:" actual
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
39 test_expect_success 'status.renames inherits from diff.renames true' '
40 git -c diff.renames=true status >actual &&
41 test_grep "renamed:" actual
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
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
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
61 test_expect_success 'status status.renames=true' '
62 git -c status.renames=true status >actual &&
63 test_grep "renamed:" actual
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
72 test_expect_success 'commit honors status.renames=true' '
73 git -c status.renames=true commit --dry-run >actual &&
74 test_grep "renamed:" actual
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
83 test_expect_success 'status score=100%' '
84 git status -M=100% >actual &&
85 test_grep "deleted:" actual &&
86 test_grep "new file:" actual &&
88 git status --find-renames=100% >actual &&
89 test_grep "deleted:" actual &&
90 test_grep "new file:" actual
93 test_expect_success 'status score=01%' '
94 git status -M=01% >actual &&
95 test_grep "renamed:" actual &&
97 git status --find-renames=01% >actual &&
98 test_grep "renamed:" actual
101 test_expect_success 'copies not overridden by find-renames' '
102 cp renamed copy &&
103 git add copy &&
105 git -c status.renames=copies status -M=01% >actual &&
106 test_grep "copied:" actual &&
107 test_grep "renamed:" actual &&
109 git -c status.renames=copies status --find-renames=01% >actual &&
110 test_grep "copied:" actual &&
111 test_grep "renamed:" actual
114 test_done