]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3300-funny-names.sh
Missing statics.
[thirdparty/git.git] / t / t3300-funny-names.sh
CommitLineData
4d2060ef
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='Pathnames with funny characters.
7
8This test tries pathnames with funny characters in the working
9tree, index, and tree objects.
10'
11
12. ./test-lib.sh
13
14p0='no-funny'
73ab46d6 15p1='tabs ," (dq) and spaces'
508c1d1c 16p2='just space'
4d2060ef
JH
17
18cat >"$p0" <<\EOF
191. A quick brown fox jumps over the lazy cat, oops dog.
202. A quick brown fox jumps over the lazy cat, oops dog.
213. A quick brown fox jumps over the lazy cat, oops dog.
22EOF
23
24cat >"$p1" "$p0"
508c1d1c 25echo 'Foo Bar Baz' >"$p2"
4d2060ef 26
6ce18321
JH
27test -f "$p1" && cmp "$p0" "$p1" || {
28 # since FAT/NTFS does not allow tabs in filenames, skip this test
29 say 'Your filesystem does not allow tabs in filenames, test skipped.'
30 test_done
31}
32
508c1d1c
JH
33echo 'just space
34no-funny' >expected
4d2060ef 35test_expect_success 'git-ls-files no-funny' \
508c1d1c 36 'git-update-index --add "$p0" "$p2" &&
4d2060ef 37 git-ls-files >current &&
5bd74506 38 git diff expected current'
4d2060ef
JH
39
40t0=`git-write-tree`
41echo "$t0" >t0
42
003d6dda
EW
43cat > expected <<\EOF
44just space
508c1d1c 45no-funny
003d6dda
EW
46"tabs\t,\" (dq) and spaces"
47EOF
4d2060ef
JH
48test_expect_success 'git-ls-files with-funny' \
49 'git-update-index --add "$p1" &&
50 git-ls-files >current &&
5bd74506 51 git diff expected current'
4d2060ef 52
508c1d1c
JH
53echo 'just space
54no-funny
73ab46d6 55tabs ," (dq) and spaces' >expected
4d2060ef
JH
56test_expect_success 'git-ls-files -z with-funny' \
57 'git-ls-files -z | tr \\0 \\012 >current &&
5bd74506 58 git diff expected current'
4d2060ef
JH
59
60t1=`git-write-tree`
61echo "$t1" >t1
62
003d6dda
EW
63cat > expected <<\EOF
64just space
508c1d1c 65no-funny
003d6dda
EW
66"tabs\t,\" (dq) and spaces"
67EOF
4d2060ef
JH
68test_expect_success 'git-ls-tree with funny' \
69 'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
5bd74506 70 git diff expected current'
4d2060ef 71
003d6dda
EW
72cat > expected <<\EOF
73A "tabs\t,\" (dq) and spaces"
74EOF
4d2060ef
JH
75test_expect_success 'git-diff-index with-funny' \
76 'git-diff-index --name-status $t0 >current &&
5bd74506 77 git diff expected current'
4d2060ef
JH
78
79test_expect_success 'git-diff-tree with-funny' \
80 'git-diff-tree --name-status $t0 $t1 >current &&
5bd74506 81 git diff expected current'
4d2060ef
JH
82
83echo 'A
73ab46d6 84tabs ," (dq) and spaces' >expected
4d2060ef
JH
85test_expect_success 'git-diff-index -z with-funny' \
86 'git-diff-index -z --name-status $t0 | tr \\0 \\012 >current &&
5bd74506 87 git diff expected current'
4d2060ef
JH
88
89test_expect_success 'git-diff-tree -z with-funny' \
90 'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
5bd74506 91 git diff expected current'
4d2060ef 92
003d6dda
EW
93cat > expected <<\EOF
94CNUM no-funny "tabs\t,\" (dq) and spaces"
95EOF
4d2060ef
JH
96test_expect_success 'git-diff-tree -C with-funny' \
97 'git-diff-tree -C --find-copies-harder --name-status \
98 $t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
5bd74506 99 git diff expected current'
4d2060ef 100
003d6dda
EW
101cat > expected <<\EOF
102RNUM no-funny "tabs\t,\" (dq) and spaces"
103EOF
4d2060ef
JH
104test_expect_success 'git-diff-tree delete with-funny' \
105 'git-update-index --force-remove "$p0" &&
106 git-diff-index -M --name-status \
107 $t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
5bd74506 108 git diff expected current'
4d2060ef 109
003d6dda
EW
110cat > expected <<\EOF
111diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
4d2060ef
JH
112similarity index NUM%
113rename from no-funny
003d6dda
EW
114rename to "tabs\t,\" (dq) and spaces"
115EOF
4d2060ef
JH
116test_expect_success 'git-diff-tree delete with-funny' \
117 'git-diff-index -M -p $t0 |
118 sed -e "s/index [0-9]*%/index NUM%/" >current &&
5bd74506 119 git diff expected current'
4d2060ef
JH
120
121chmod +x "$p1"
003d6dda
EW
122cat > expected <<\EOF
123diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
4d2060ef
JH
124old mode 100644
125new mode 100755
126similarity index NUM%
127rename from no-funny
003d6dda
EW
128rename to "tabs\t,\" (dq) and spaces"
129EOF
4d2060ef
JH
130test_expect_success 'git-diff-tree delete with-funny' \
131 'git-diff-index -M -p $t0 |
132 sed -e "s/index [0-9]*%/index NUM%/" >current &&
5bd74506 133 git diff expected current'
4d2060ef 134
003d6dda
EW
135cat >expected <<\EOF
136 "tabs\t,\" (dq) and spaces"
137 1 files changed, 0 insertions(+), 0 deletions(-)
138EOF
4d2060ef
JH
139test_expect_success 'git-diff-tree rename with-funny applied' \
140 'git-diff-index -M -p $t0 |
141 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
5bd74506 142 git diff expected current'
4d2060ef 143
003d6dda
EW
144cat > expected <<\EOF
145 no-funny
73ab46d6 146 "tabs\t,\" (dq) and spaces"
003d6dda
EW
147 2 files changed, 3 insertions(+), 3 deletions(-)
148EOF
4d2060ef
JH
149test_expect_success 'git-diff-tree delete with-funny applied' \
150 'git-diff-index -p $t0 |
151 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
5bd74506 152 git diff expected current'
4d2060ef
JH
153
154test_expect_success 'git-apply non-git diff' \
155 'git-diff-index -p $t0 |
156 sed -ne "/^[-+@]/p" |
157 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
5bd74506 158 git diff expected current'
4d2060ef
JH
159
160test_done