]> git.ipfire.org Git - thirdparty/git.git/blame - t/t0050-filesystem.sh
Documentation: user-manual: "git commit -a" doesn't motivate .gitignore
[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
e8e29c7b
JK
7auml=`printf '\xc3\xa4'`
8aumlcdiar=`printf '\x61\xcc\x88'`
b560707a 9
1c51c7d7 10case_insensitive=
b560707a
SP
11test_expect_success 'see if we expect ' '
12
13 test_case=test_expect_success
14 test_unicode=test_expect_success
15 mkdir junk &&
16 echo good >junk/CamelCase &&
17 echo bad >junk/camelcase &&
18 if test "$(cat junk/CamelCase)" != good
19 then
20 test_case=test_expect_failure
1c51c7d7 21 case_insensitive=t
b560707a
SP
22 say "will test on a case insensitive filesystem"
23 fi &&
24 rm -fr junk &&
25 mkdir junk &&
26 >junk/"$auml" &&
27 case "$(cd junk && echo *)" in
28 "$aumlcdiar")
29 test_unicode=test_expect_failure
30 say "will test on a unicode corrupting filesystem"
31 ;;
32 *) ;;
33 esac &&
34 rm -fr junk
35'
36
1c51c7d7
SP
37if test "$case_insensitive"
38then
39test_expect_success "detection of case insensitive filesystem during repo init" '
40
41 test $(git config --bool core.ignorecase) = true
42'
43else
44test_expect_success "detection of case insensitive filesystem during repo init" '
45
d492b31c 46 test_must_fail git config --bool core.ignorecase >/dev/null ||
1c51c7d7
SP
47 test $(git config --bool core.ignorecase) = false
48'
49fi
50
b560707a
SP
51test_expect_success "setup case tests" '
52
b4a299d8 53 git config core.ignorecase true &&
b560707a
SP
54 touch camelcase &&
55 git add camelcase &&
56 git commit -m "initial" &&
57 git tag initial &&
58 git checkout -b topic &&
59 git mv camelcase tmp &&
60 git mv tmp CamelCase &&
61 git commit -m "rename" &&
62 git checkout -f master
63
64'
65
66$test_case 'rename (case change)' '
67
68 git mv camelcase CamelCase &&
69 git commit -m "rename"
70
71'
72
73$test_case 'merge (case change)' '
74
0047dd2f
SP
75 rm -f CamelCase &&
76 rm -f camelcase &&
b560707a
SP
77 git reset --hard initial &&
78 git merge topic
79
80'
81
8a19aaab
SP
82$test_case 'add (with different case)' '
83
84 git reset --hard initial &&
85 rm camelcase &&
86 echo 1 >CamelCase &&
87 git add CamelCase &&
88 test $(git-ls-files | grep -i camelcase | wc -l) = 1
89
90'
91
b560707a
SP
92test_expect_success "setup unicode normalization tests" '
93
94 test_create_repo unicode &&
95 cd unicode &&
96 touch "$aumlcdiar" &&
97 git add "$aumlcdiar" &&
98 git commit -m initial
99 git tag initial &&
100 git checkout -b topic &&
101 git mv $aumlcdiar tmp &&
102 git mv tmp "$auml" &&
103 git commit -m rename &&
104 git checkout -f master
105
106'
107
108$test_unicode 'rename (silent unicode normalization)' '
109
110 git mv "$aumlcdiar" "$auml" &&
111 git commit -m rename
112
113'
114
115$test_unicode 'merge (silent unicode normalization)' '
116
117 git reset --hard initial &&
118 git merge topic
119
120'
121
122test_done