3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Pathnames with funny characters.
8 This test tries pathnames with funny characters in the working
9 tree, index, and tree objects.
15 p1
='tabs ," (dq) and spaces'
19 1. A quick brown fox jumps over the lazy
cat, oops dog.
20 2. A quick brown fox jumps over the lazy
cat, oops dog.
21 3. A quick brown fox jumps over the lazy
cat, oops dog.
25 echo 'Foo Bar Baz' >"$p2"
27 test -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.'
35 test_expect_success
'git ls-files no-funny' \
36 'git update-index --add "$p0" "$p2" &&
37 git ls-files >current &&
38 git diff expected current'
46 "tabs\t,\" (dq) and spaces"
48 test_expect_success
'git ls-files with-funny' \
49 'git update-index --add "$p1" &&
50 git ls-files >current &&
51 git diff expected current'
55 tabs ," (dq) and spaces' >expected
56 test_expect_success
'git ls-files -z with-funny' \
57 'git ls-files -z | perl -pe y/\\000/\\012/ >current &&
58 git diff expected current'
66 "tabs\t,\" (dq) and spaces"
68 test_expect_success
'git ls-tree with funny' \
69 'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
70 git diff expected current'
73 A
"tabs\t,\" (dq) and spaces"
75 test_expect_success
'git diff-index with-funny' \
76 'git diff-index --name-status $t0 >current &&
77 git diff expected current'
79 test_expect_success
'git diff-tree with-funny' \
80 'git diff-tree --name-status $t0 $t1 >current &&
81 git diff expected current'
84 tabs ," (dq) and spaces' >expected
85 test_expect_success
'git diff-index -z with-funny' \
86 'git diff-index -z --name-status $t0 | perl -pe y/\\000/\\012/ >current &&
87 git diff expected current'
89 test_expect_success
'git diff-tree -z with-funny' \
90 'git diff-tree -z --name-status $t0 $t1 | perl -pe y/\\000/\\012/ >current &&
91 git diff expected current'
94 CNUM no-funny
"tabs\t,\" (dq) and spaces"
96 test_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 &&
99 git diff expected current'
101 cat > expected
<<\EOF
102 RNUM no-funny
"tabs\t,\" (dq) and spaces"
104 test_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 &&
108 git diff expected current'
110 cat > expected
<<\EOF
111 diff --git a
/no-funny
"b/tabs\t,\" (dq) and spaces"
112 similarity index NUM
%
114 rename to
"tabs\t,\" (dq) and spaces"
116 test_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 &&
119 git diff expected current'
122 cat > expected
<<\EOF
123 diff --git a
/no-funny
"b/tabs\t,\" (dq) and spaces"
126 similarity index NUM
%
128 rename to
"tabs\t,\" (dq) and spaces"
130 test_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 &&
133 git diff expected current'
136 "tabs\t,\" (dq) and spaces"
137 1 files changed
, 0 insertions
(+), 0 deletions
(-)
139 test_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 &&
142 git diff expected current'
144 cat > expected
<<\EOF
146 "tabs\t,\" (dq) and spaces"
147 2 files changed
, 3 insertions
(+), 3 deletions
(-)
149 test_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 &&
152 git diff expected current'
154 test_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 &&
158 git diff expected current'