@matheusbsbs / matheus-bagliano / commits / 003d6ddaf4
Fork 0

t3300-funny-names: shell portability fixes

echo isn't remotely standardized for handling backslashes, so cat + heredoc seems better Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Eric Wong committed May 25, 2006 at 19:06 UTC 003d6ddaf41aa5614ac49693d199d1ad5f21fcbf
1 file changed +33 -18
t/t3300-funny-names.sh
+33 -18
@@ -40,9 +40,11 @@ test_expect_success 'git-ls-files no-funny' \
40 t0=`git-write-tree`
41 echo "$t0" >t0
42
43 -echo 'just space
43 +cat > expected <<\EOF
44 +just space
45 no-funny
45 -"tabs\t,\" (dq) and spaces"' >expected
46 +"tabs\t,\" (dq) and spaces"
47 +EOF
48 test_expect_success 'git-ls-files with-funny' \
49 'git-update-index --add "$p1" &&
50 git-ls-files >current &&
@@ -58,14 +60,18 @@ test_expect_success 'git-ls-files -z with-funny' \
60 t1=`git-write-tree`
61 echo "$t1" >t1
62
61 -echo 'just space
63 +cat > expected <<\EOF
64 +just space
65 no-funny
63 -"tabs\t,\" (dq) and spaces"' >expected
66 +"tabs\t,\" (dq) and spaces"
67 +EOF
68 test_expect_success 'git-ls-tree with funny' \
69 'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
70 diff -u expected current'
71
68 -echo 'A "tabs\t,\" (dq) and spaces"' >expected
72 +cat > expected <<\EOF
73 +A "tabs\t,\" (dq) and spaces"
74 +EOF
75 test_expect_success 'git-diff-index with-funny' \
76 'git-diff-index --name-status $t0 >current &&
77 diff -u expected current'
@@ -84,53 +90,62 @@ test_expect_success 'git-diff-tree -z with-funny' \
90 'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
91 diff -u expected current'
92
87 -echo 'CNUM no-funny "tabs\t,\" (dq) and spaces"' >expected
93 +cat > expected <<\EOF
94 +CNUM no-funny "tabs\t,\" (dq) and spaces"
95 +EOF
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 diff -u expected current'
100
93 -echo 'RNUM no-funny "tabs\t,\" (dq) and spaces"' >expected
101 +cat > expected <<\EOF
102 +RNUM no-funny "tabs\t,\" (dq) and spaces"
103 +EOF
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 diff -u expected current'
109
100 -echo 'diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
110 +cat > expected <<\EOF
111 +diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
112 similarity index NUM%
113 rename from no-funny
103 -rename to "tabs\t,\" (dq) and spaces"' >expected
104 -
114 +rename to "tabs\t,\" (dq) and spaces"
115 +EOF
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 diff -u expected current'
120
121 chmod +x "$p1"
111 -echo 'diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
122 +cat > expected <<\EOF
123 +diff --git a/no-funny "b/tabs\t,\" (dq) and spaces"
124 old mode 100644
125 new mode 100755
126 similarity index NUM%
127 rename from no-funny
116 -rename to "tabs\t,\" (dq) and spaces"' >expected
117 -
128 +rename to "tabs\t,\" (dq) and spaces"
129 +EOF
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 diff -u expected current'
134
123 -echo >expected ' "tabs\t,\" (dq) and spaces"
124 - 1 files changed, 0 insertions(+), 0 deletions(-)'
135 +cat >expected <<\EOF
136 + "tabs\t,\" (dq) and spaces"
137 + 1 files changed, 0 insertions(+), 0 deletions(-)
138 +EOF
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 diff -u expected current'
143
130 -echo >expected ' no-funny
144 +cat > expected <<\EOF
145 + no-funny
146 "tabs\t,\" (dq) and spaces"
132 - 2 files changed, 3 insertions(+), 3 deletions(-)'
133 -
147 + 2 files changed, 3 insertions(+), 3 deletions(-)
148 +EOF
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 &&