Merge branch 'jk/index-pack-maint'
[git.git] / t / t7525-status-rename.sh
blobef8b1b307851084308b1d8553c41c5e9dc61b836
1 #!/bin/sh
3 test_description='git status rename detection options'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 echo 1 >original &&
9 git add . &&
10 git commit -m"Adding original file." &&
11 mv original renamed &&
12 echo 2 >> renamed &&
13 git add . &&
14 cat >.gitignore <<-\EOF
15 .gitignore
16 expect*
17 actual*
18 EOF
21 test_expect_success 'status no-options' '
22 git status >actual &&
23 test_i18ngrep "renamed:" actual
26 test_expect_success 'status --no-renames' '
27 git status --no-renames >actual &&
28 test_i18ngrep "deleted:" actual &&
29 test_i18ngrep "new file:" actual
32 test_expect_success 'status.renames inherits from diff.renames false' '
33 git -c diff.renames=false status >actual &&
34 test_i18ngrep "deleted:" actual &&
35 test_i18ngrep "new file:" actual
38 test_expect_success 'status.renames inherits from diff.renames true' '
39 git -c diff.renames=true status >actual &&
40 test_i18ngrep "renamed:" actual
43 test_expect_success 'status.renames overrides diff.renames false' '
44 git -c diff.renames=true -c status.renames=false status >actual &&
45 test_i18ngrep "deleted:" actual &&
46 test_i18ngrep "new file:" actual
49 test_expect_success 'status.renames overrides from diff.renames true' '
50 git -c diff.renames=false -c status.renames=true status >actual &&
51 test_i18ngrep "renamed:" actual
54 test_expect_success 'status status.renames=false' '
55 git -c status.renames=false status >actual &&
56 test_i18ngrep "deleted:" actual &&
57 test_i18ngrep "new file:" actual
60 test_expect_success 'status status.renames=true' '
61 git -c status.renames=true status >actual &&
62 test_i18ngrep "renamed:" actual
65 test_expect_success 'commit honors status.renames=false' '
66 git -c status.renames=false commit --dry-run >actual &&
67 test_i18ngrep "deleted:" actual &&
68 test_i18ngrep "new file:" actual
71 test_expect_success 'commit honors status.renames=true' '
72 git -c status.renames=true commit --dry-run >actual &&
73 test_i18ngrep "renamed:" actual
76 test_expect_success 'status config overridden' '
77 git -c status.renames=true status --no-renames >actual &&
78 test_i18ngrep "deleted:" actual &&
79 test_i18ngrep "new file:" actual
82 test_expect_success 'status score=100%' '
83 git status -M=100% >actual &&
84 test_i18ngrep "deleted:" actual &&
85 test_i18ngrep "new file:" actual &&
87 git status --find-rename=100% >actual &&
88 test_i18ngrep "deleted:" actual &&
89 test_i18ngrep "new file:" actual
92 test_expect_success 'status score=01%' '
93 git status -M=01% >actual &&
94 test_i18ngrep "renamed:" actual &&
96 git status --find-rename=01% >actual &&
97 test_i18ngrep "renamed:" actual
100 test_expect_success 'copies not overridden by find-rename' '
101 cp renamed copy &&
102 git add copy &&
104 git -c status.renames=copies status -M=01% >actual &&
105 test_i18ngrep "copied:" actual &&
106 test_i18ngrep "renamed:" actual &&
108 git -c status.renames=copies status --find-rename=01% >actual &&
109 test_i18ngrep "copied:" actual &&
110 test_i18ngrep "renamed:" actual
113 test_done