]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0050-filesystem.sh
Merge branch 'jc/remove-treesame-parent-in-simplify-merges'
[thirdparty/git.git] / t / t0050-filesystem.sh
CommitLineData
b560707a
SP
1#!/bin/sh
2
3test_description='Various filesystem issues'
4
5. ./test-lib.sh
6
77e57265
JN
7auml=$(printf '\303\244')
8aumlcdiar=$(printf '\141\314\210')
b560707a 9
9a3658b9
MG
10if test_have_prereq CASE_INSENSITIVE_FS
11then
5b46a428 12 say "will test on a case insensitive filesystem"
9a3658b9
MG
13 test_case=test_expect_failure
14else
15 test_case=test_expect_success
16fi
17
5b0b5dd4
MG
18if test_have_prereq UTF8_NFD_TO_NFC
19then
5b46a428 20 say "will test on a unicode corrupting filesystem"
5b0b5dd4
MG
21 test_unicode=test_expect_failure
22else
23 test_unicode=test_expect_success
24fi
25
2b71b522 26test_have_prereq SYMLINKS ||
64e61f2d 27 say "will test on a filesystem lacking symbolic links"
5b46a428 28
9a3658b9 29if test_have_prereq CASE_INSENSITIVE_FS
1c51c7d7
SP
30then
31test_expect_success "detection of case insensitive filesystem during repo init" '
1c51c7d7
SP
32 test $(git config --bool core.ignorecase) = true
33'
34else
35test_expect_success "detection of case insensitive filesystem during repo init" '
d492b31c 36 test_must_fail git config --bool core.ignorecase >/dev/null ||
1c51c7d7
SP
37 test $(git config --bool core.ignorecase) = false
38'
39fi
40
2b71b522 41if test_have_prereq SYMLINKS
64e61f2d
JS
42then
43test_expect_success "detection of filesystem w/o symlink support during repo init" '
2b71b522
MG
44 test_must_fail git config --bool core.symlinks ||
45 test "$(git config --bool core.symlinks)" = true
64e61f2d
JS
46'
47else
48test_expect_success "detection of filesystem w/o symlink support during repo init" '
2b71b522
MG
49 v=$(git config --bool core.symlinks) &&
50 test "$v" = false
64e61f2d
JS
51'
52fi
53
b560707a 54test_expect_success "setup case tests" '
b4a299d8 55 git config core.ignorecase true &&
b560707a
SP
56 touch camelcase &&
57 git add camelcase &&
58 git commit -m "initial" &&
59 git tag initial &&
60 git checkout -b topic &&
61 git mv camelcase tmp &&
62 git mv tmp CamelCase &&
63 git commit -m "rename" &&
64 git checkout -f master
b560707a
SP
65'
66
67$test_case 'rename (case change)' '
b560707a
SP
68 git mv camelcase CamelCase &&
69 git commit -m "rename"
b560707a
SP
70'
71
004c0be7 72test_expect_success 'merge (case change)' '
0047dd2f
SP
73 rm -f CamelCase &&
74 rm -f camelcase &&
b560707a
SP
75 git reset --hard initial &&
76 git merge topic
b560707a
SP
77'
78
0d7c2430
JH
79
80
4084475b 81test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' '
8a19aaab
SP
82 git reset --hard initial &&
83 rm camelcase &&
84 echo 1 >CamelCase &&
85 git add CamelCase &&
0d7c2430
JH
86 camel=$(git ls-files | grep -i camelcase) &&
87 test $(echo "$camel" | wc -l) = 1 &&
88 test "z$(git cat-file blob :$camel)" = z1
8a19aaab
SP
89'
90
b560707a 91test_expect_success "setup unicode normalization tests" '
336e2e27
TB
92 test_create_repo unicode &&
93 cd unicode &&
94 touch "$aumlcdiar" &&
95 git add "$aumlcdiar" &&
96 git commit -m initial &&
97 git tag initial &&
98 git checkout -b topic &&
99 git mv $aumlcdiar tmp &&
100 git mv tmp "$auml" &&
101 git commit -m rename &&
102 git checkout -f master
b560707a
SP
103'
104
105$test_unicode 'rename (silent unicode normalization)' '
336e2e27
TB
106 git mv "$aumlcdiar" "$auml" &&
107 git commit -m rename
b560707a
SP
108'
109
110$test_unicode 'merge (silent unicode normalization)' '
336e2e27
TB
111 git reset --hard initial &&
112 git merge topic
b560707a
SP
113'
114
115test_done