the use of 'tr' in the test suite isn't really portable
Some versions of 'tr' only accept octal codes if entered with three digits, and therefor misinterpret the '\0' in the test suite. Some versions of 'tr' reject the (needless) use of character classes. Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
H.Merijn Brand committed
Dec 17, 2007 at 23:28 UTC
3175b0cfc1392de1ff00c01796f85b92df317cc8
11 files changed
+18
-18
git-filter-branch.sh
+1
-1
@@ -290,7 +290,7 @@ while read commit parents; do
290
eval "$filter_tree" < /dev/null ||
291
die "tree filter failed: $filter_tree"
292
293
- git diff-index -r $commit | cut -f 2- | tr '\n' '\0' | \
293
+ git diff-index -r $commit | cut -f 2- | tr '\n' '\000' | \
294
xargs -0 git update-index --add --replace --remove
295
git ls-files -z --others | \
296
xargs -0 git update-index --add --replace --remove
t/diff-lib.sh
+2
-2
@@ -21,8 +21,8 @@ compare_diff_raw_z () {
21
# Also we do not check SHA1 hash generation in this test, which
22
# is a job for t0000-basic.sh
23
24
- tr '\0' '\012' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
25
- tr '\0' '\012' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
24
+ tr '\000' '\012' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
25
+ tr '\000' '\012' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
26
git diff .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
27
}
28
t/t0020-crlf.sh
+1
-1
@@ -5,7 +5,7 @@ test_description='CRLF conversion'
5
. ./test-lib.sh
6
7
q_to_nul () {
8
- tr Q '\0'
8
+ tr Q '\000'
9
}
10
11
append_cr () {
t/t1300-repo-config.sh
+2
-2
@@ -591,12 +591,12 @@ Qsection.sub=section.val4
591
Qsection.sub=section.val5Q
592
EOF
593
594
-git config --null --list | tr '[\000]' 'Q' > result
594
+git config --null --list | tr '\000' 'Q' > result
595
echo >>result
596
597
test_expect_success '--null --list' 'cmp result expect'
598
599
-git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result
599
+git config --null --get-regexp 'val[0-9]' | tr '\000' 'Q' > result
600
echo >>result
601
602
test_expect_success '--null --get-regexp' 'cmp result expect'
t/t3300-funny-names.sh
+3
-3
@@ -54,7 +54,7 @@ echo 'just space
54
no-funny
55
tabs ," (dq) and spaces' >expected
56
test_expect_success 'git ls-files -z with-funny' \
57
- 'git ls-files -z | tr \\0 \\012 >current &&
57
+ 'git ls-files -z | tr \\000 \\012 >current &&
58
git diff expected current'
59
60
t1=`git write-tree`
@@ -83,11 +83,11 @@ test_expect_success 'git diff-tree with-funny' \
83
echo 'A
84
tabs ," (dq) and spaces' >expected
85
test_expect_success 'git diff-index -z with-funny' \
86
- 'git diff-index -z --name-status $t0 | tr \\0 \\012 >current &&
86
+ 'git diff-index -z --name-status $t0 | tr \\000 \\012 >current &&
87
git diff expected current'
88
89
test_expect_success 'git diff-tree -z with-funny' \
90
- 'git diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
90
+ 'git diff-tree -z --name-status $t0 $t1 | tr \\000 \\012 >current &&
91
git diff expected current'
92
93
cat > expected <<\EOF
t/t4020-diff-external.sh
+1
-1
@@ -99,7 +99,7 @@ test_expect_success 'no diff with -diff' '
99
git diff | grep Binary
100
'
101
102
-echo NULZbetweenZwords | tr Z '\0' > file
102
+echo NULZbetweenZwords | tr Z '\000' > file
103
104
test_expect_success 'force diff with "diff"' '
105
echo >.gitattributes "file diff" &&
t/t4103-apply-binary.sh
+2
-2
@@ -24,10 +24,10 @@ git update-index --add --remove file1 file2 file4
24
git-commit -m 'Initial Version' 2>/dev/null
25
26
git-checkout -b binary
27
-tr 'x' '\0' <file1 >file3
27
+tr 'x' '\000' <file1 >file3
28
cat file3 >file4
29
git add file2
30
-tr '\0' 'v' <file3 >file1
30
+tr '\000' 'v' <file3 >file1
31
rm -f file2
32
git update-index --add --remove file1 file2 file3 file4
33
git-commit -m 'Second Version'
t/t4116-apply-reverse.sh
+2
-2
@@ -12,14 +12,14 @@ test_description='git apply in reverse
12
test_expect_success setup '
13
14
for i in a b c d e f g h i j k l m n; do echo $i; done >file1 &&
15
- tr "[ijk]" '\''[\0\1\2]'\'' <file1 >file2 &&
15
+ tr "ijk" '\''\000\001\002'\'' <file1 >file2 &&
16
17
git add file1 file2 &&
18
git commit -m initial &&
19
git tag initial &&
20
21
for i in a b c g h i J K L m o n p q; do echo $i; done >file1 &&
22
- tr "[mon]" '\''[\0\1\2]'\'' <file1 >file2 &&
22
+ tr "mon" '\''\000\001\002'\'' <file1 >file2 &&
23
24
git commit -a -m second &&
25
git tag second &&
t/t4200-rerere.sh
+1
-1
@@ -129,7 +129,7 @@ test_expect_success 'rerere kicked in' "! grep ======= a1"
129
test_expect_success 'rerere prefers first change' 'git diff a1 expect'
130
131
rm $rr/postimage
132
-echo "$sha1 a1" | tr '\012' '\0' > .git/rr-cache/MERGE_RR
132
+echo "$sha1 a1" | tr '\012' '\000' > .git/rr-cache/MERGE_RR
133
134
test_expect_success 'rerere clear' 'git rerere clear'
135
t/t5300-pack-object.sh
+1
-1
@@ -15,7 +15,7 @@ test_expect_success \
15
'rm -f .git/index*
16
for i in a b c
17
do
18
- dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i &&
18
+ dd if=/dev/zero bs=4k count=1 | tr "\\000" $i >$i &&
19
git update-index --add $i || return 1
20
done &&
21
cat c >d && echo foo >>d && git update-index --add d &&
test-sha1.sh
+2
-2
@@ -10,7 +10,7 @@ do
10
{
11
test -z "$pfx" || echo "$pfx"
12
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
13
- tr '[\0]' '[g]'
13
+ tr '\000' 'g'
14
} | ./test-sha1 $cnt
15
`
16
if test "$expect" = "$actual"
@@ -55,7 +55,7 @@ do
55
{
56
test -z "$pfx" || echo "$pfx"
57
dd if=/dev/zero bs=1048576 count=$cnt 2>/dev/null |
58
- tr '[\0]' '[g]'
58
+ tr '\000' 'g'
59
} | sha1sum |
60
sed -e 's/ .*//'
61
`