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.
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"
29 test_expect_success
'git-ls-files no-funny' \
30 'git-update-index --add "$p0" "$p2" &&
31 git-ls-files >current &&
32 diff -u expected current'
39 "tabs\tand spaces"' >expected
40 test_expect_success
'git-ls-files with-funny' \
41 'git-update-index --add "$p1" &&
42 git-ls-files >current &&
43 diff -u expected current'
47 tabs and spaces' >expected
48 test_expect_success
'git-ls-files -z with-funny' \
49 'git-ls-files -z | tr \\0 \\012 >current &&
50 diff -u expected current'
57 "tabs\tand spaces"' >expected
58 test_expect_success
'git-ls-tree with funny' \
59 'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
60 diff -u expected current'
62 echo 'A "tabs\tand spaces"' >expected
63 test_expect_success
'git-diff-index with-funny' \
64 'git-diff-index --name-status $t0 >current &&
65 diff -u expected current'
67 test_expect_success
'git-diff-tree with-funny' \
68 'git-diff-tree --name-status $t0 $t1 >current &&
69 diff -u expected current'
72 tabs and spaces' >expected
73 test_expect_success
'git-diff-index -z with-funny' \
74 'git-diff-index -z --name-status $t0 | tr \\0 \\012 >current &&
75 diff -u expected current'
77 test_expect_success
'git-diff-tree -z with-funny' \
78 'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
79 diff -u expected current'
81 echo 'CNUM no-funny "tabs\tand spaces"' >expected
82 test_expect_success
'git-diff-tree -C with-funny' \
83 'git-diff-tree -C --find-copies-harder --name-status \
84 $t0 $t1 | sed -e 's
/^C
[0-9]*/CNUM
/' >current &&
85 diff -u expected current'
87 echo 'RNUM no-funny "tabs\tand spaces"' >expected
88 test_expect_success
'git-diff-tree delete with-funny' \
89 'git-update-index --force-remove "$p0" &&
90 git-diff-index -M --name-status \
91 $t0 | sed -e 's
/^R
[0-9]*/RNUM
/' >current &&
92 diff -u expected current'
94 echo 'diff --git a/no-funny "b/tabs\tand spaces"
97 rename to "tabs\tand spaces"' >expected
99 test_expect_success
'git-diff-tree delete with-funny' \
100 'git-diff-index -M -p $t0 |
101 sed -e "s/index [0-9]*%/index NUM%/" >current &&
102 diff -u expected current'
105 echo 'diff --git a/no-funny "b/tabs\tand spaces"
108 similarity index NUM%
110 rename to "tabs\tand spaces"' >expected
112 test_expect_success
'git-diff-tree delete with-funny' \
113 'git-diff-index -M -p $t0 |
114 sed -e "s/index [0-9]*%/index NUM%/" >current &&
115 diff -u expected current'
117 echo >expected
' "tabs\tand spaces"
118 1 files changed, 0 insertions(+), 0 deletions(-)'
119 test_expect_success
'git-diff-tree rename with-funny applied' \
120 'git-diff-index -M -p $t0 |
121 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
122 diff -u expected current'
124 echo >expected
' no-funny
126 2 files changed, 3 insertions(+), 3 deletions(-)'
128 test_expect_success
'git-diff-tree delete with-funny applied' \
129 'git-diff-index -p $t0 |
130 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
131 diff -u expected current'
133 test_expect_success
'git-apply non-git diff' \
134 'git-diff-index -p $t0 |
135 sed -ne "/^[-+@]/p" |
136 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
137 diff -u expected current'