]>
Commit | Line | Data |
---|---|---|
e8b2dc2c BP |
1 | #!/bin/sh |
2 | ||
3 | test_description='git status rename detection options' | |
4 | ||
d96fb140 | 5 | TEST_PASSES_SANITIZE_LEAK=true |
e8b2dc2c BP |
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_i18ngrep "renamed:" actual | |
25 | ' | |
26 | ||
27 | test_expect_success 'status --no-renames' ' | |
28 | git status --no-renames >actual && | |
29 | test_i18ngrep "deleted:" actual && | |
30 | test_i18ngrep "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_i18ngrep "deleted:" actual && | |
36 | test_i18ngrep "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_i18ngrep "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_i18ngrep "deleted:" actual && | |
47 | test_i18ngrep "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_i18ngrep "renamed:" actual | |
53 | ' | |
54 | ||
55 | test_expect_success 'status status.renames=false' ' | |
56 | git -c status.renames=false status >actual && | |
57 | test_i18ngrep "deleted:" actual && | |
58 | test_i18ngrep "new file:" actual | |
59 | ' | |
60 | ||
61 | test_expect_success 'status status.renames=true' ' | |
62 | git -c status.renames=true status >actual && | |
63 | test_i18ngrep "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_i18ngrep "deleted:" actual && | |
69 | test_i18ngrep "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_i18ngrep "renamed:" actual | |
75 | ' | |
76 | ||
77 | test_expect_success 'status config overridden' ' | |
78 | git -c status.renames=true status --no-renames >actual && | |
79 | test_i18ngrep "deleted:" actual && | |
80 | test_i18ngrep "new file:" actual | |
81 | ' | |
82 | ||
83 | test_expect_success 'status score=100%' ' | |
84 | git status -M=100% >actual && | |
85 | test_i18ngrep "deleted:" actual && | |
86 | test_i18ngrep "new file:" actual && | |
87 | ||
c4932b00 | 88 | git status --find-renames=100% >actual && |
e8b2dc2c BP |
89 | test_i18ngrep "deleted:" actual && |
90 | test_i18ngrep "new file:" actual | |
91 | ' | |
92 | ||
93 | test_expect_success 'status score=01%' ' | |
94 | git status -M=01% >actual && | |
95 | test_i18ngrep "renamed:" actual && | |
96 | ||
c4932b00 | 97 | git status --find-renames=01% >actual && |
e8b2dc2c BP |
98 | test_i18ngrep "renamed:" actual |
99 | ' | |
100 | ||
c4932b00 | 101 | test_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 && | |
106 | test_i18ngrep "copied:" actual && | |
107 | test_i18ngrep "renamed:" actual && | |
108 | ||
c4932b00 | 109 | git -c status.renames=copies status --find-renames=01% >actual && |
e8b2dc2c BP |
110 | test_i18ngrep "copied:" actual && |
111 | test_i18ngrep "renamed:" actual | |
112 | ' | |
113 | ||
114 | test_done |