Merge branch 'ds/reprepare-alternates-when-repreparing-packfiles'
[alt-git.git] / t / t7525-status-rename.sh
blob22bf5c7e5dc108fabfc165e948733d6221855785
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_i18ngrep "renamed:" actual
27 test_expect_success 'status --no-renames' '
28 git status --no-renames >actual &&
29 test_i18ngrep "deleted:" actual &&
30 test_i18ngrep "new file:" actual
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
39 test_expect_success 'status.renames inherits from diff.renames true' '
40 git -c diff.renames=true status >actual &&
41 test_i18ngrep "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_i18ngrep "deleted:" actual &&
47 test_i18ngrep "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_i18ngrep "renamed:" actual
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
61 test_expect_success 'status status.renames=true' '
62 git -c status.renames=true status >actual &&
63 test_i18ngrep "renamed:" actual
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
72 test_expect_success 'commit honors status.renames=true' '
73 git -c status.renames=true commit --dry-run >actual &&
74 test_i18ngrep "renamed:" actual
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
83 test_expect_success 'status score=100%' '
84 git status -M=100% >actual &&
85 test_i18ngrep "deleted:" actual &&
86 test_i18ngrep "new file:" actual &&
88 git status --find-renames=100% >actual &&
89 test_i18ngrep "deleted:" actual &&
90 test_i18ngrep "new file:" actual
93 test_expect_success 'status score=01%' '
94 git status -M=01% >actual &&
95 test_i18ngrep "renamed:" actual &&
97 git status --find-renames=01% >actual &&
98 test_i18ngrep "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_i18ngrep "copied:" actual &&
107 test_i18ngrep "renamed:" actual &&
109 git -c status.renames=copies status --find-renames=01% >actual &&
110 test_i18ngrep "copied:" actual &&
111 test_i18ngrep "renamed:" actual
114 test_done