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.
18 1. A quick brown fox jumps over the lazy cat, oops dog.
19 2. A quick brown fox jumps over the lazy cat, oops dog.
20 3. A quick brown fox jumps over the lazy cat, oops dog.
25 echo 'no-funny' >expected
26 test_expect_success 'git-ls-files no-funny' \
27 'git-update-index --add "$p0" &&
28 git-ls-files >current &&
29 diff -u expected current'
35 "tabs\tand spaces"' >expected
36 test_expect_success 'git-ls-files with-funny' \
37 'git-update-index --add "$p1" &&
38 git-ls-files >current &&
39 diff -u expected current'
42 tabs and spaces' >expected
43 test_expect_success 'git-ls-files -z with-funny' \
44 'git-ls-files -z | tr \\0 \\012 >current &&
45 diff -u expected current'
51 "tabs\tand spaces"' >expected
52 test_expect_success 'git-ls-tree with funny' \
53 'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
54 diff -u expected current'
56 echo 'A "tabs\tand spaces"' >expected
57 test_expect_success 'git-diff-index with-funny' \
58 'git-diff-index --name-status $t0 >current &&
59 diff -u expected current'
61 test_expect_success 'git-diff-tree with-funny' \
62 'git-diff-tree --name-status $t0 $t1 >current &&
63 diff -u expected current'
66 tabs and spaces' >expected
67 test_expect_success 'git-diff-index -z with-funny' \
68 'git-diff-index -z --name-status $t0 | tr \\0 \\012 >current &&
69 diff -u expected current'
71 test_expect_success 'git-diff-tree -z with-funny' \
72 'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
73 diff -u expected current'
75 echo 'CNUM no-funny "tabs\tand spaces"' >expected
76 test_expect_success 'git-diff-tree -C with-funny' \
77 'git-diff-tree -C --find-copies-harder --name-status \
78 $t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current &&
79 diff -u expected current'
81 echo 'RNUM no-funny "tabs\tand spaces"' >expected
82 test_expect_success 'git-diff-tree delete with-funny' \
83 'git-update-index --force-remove "$p0" &&
84 git-diff-index -M --name-status \
85 $t0 | sed -e 's/^R[0-9]*/RNUM/' >current &&
86 diff -u expected current'
88 echo 'diff --git a/no-funny "b/tabs\tand spaces"
91 rename to "tabs\tand spaces"' >expected
93 test_expect_success 'git-diff-tree delete with-funny' \
94 'git-diff-index -M -p $t0 |
95 sed -e "s/index [0-9]*%/index NUM%/" >current &&
96 diff -u expected current'
99 echo 'diff --git a/no-funny "b/tabs\tand spaces"
102 similarity index NUM%
104 rename to "tabs\tand spaces"' >expected
106 test_expect_success 'git-diff-tree delete with-funny' \
107 'git-diff-index -M -p $t0 |
108 sed -e "s/index [0-9]*%/index NUM%/" >current &&
109 diff -u expected current'
111 echo >expected ' "tabs\tand spaces"
112 1 files changed, 0 insertions(+), 0 deletions(-)'
113 test_expect_success 'git-diff-tree rename with-funny applied' \
114 'git-diff-index -M -p $t0 |
115 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
116 diff -u expected current'
118 echo >expected ' no-funny
120 2 files changed, 3 insertions(+), 3 deletions(-)'
122 test_expect_success 'git-diff-tree delete with-funny applied' \
123 'git-diff-index -p $t0 |
124 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
125 diff -u expected current'
127 test_expect_success 'git-apply non-git diff' \
128 'git-diff-index -p $t0 |
129 sed -ne "/^[-+@]/p" |
130 git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
131 diff -u expected current'