test: use $_z40 from test-lib
There is no need to duplicate the definition of $_z40 and $_x40 that test-lib.sh supplies the test scripts. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Apr 23, 2011 at 22:34 UTC
3749fde561ad495dea74b0d3a13bba571068396d
12 files changed
+15
-22
t/t1400-update-ref.sh
+1
-1
@@ -6,7 +6,7 @@
6
test_description='Test git update-ref and basic ref logging'
7
. ./test-lib.sh
8
9
-Z=0000000000000000000000000000000000000000
9
+Z=$_z40
10
11
test_expect_success setup '
12
t/t1501-worktree.sh
+3
-4
@@ -7,7 +7,6 @@ test_expect_success 'setup' '
7
EMPTY_TREE=$(git write-tree) &&
8
EMPTY_BLOB=$(git hash-object -t blob --stdin </dev/null) &&
9
CHANGED_BLOB=$(echo changed | git hash-object -t blob --stdin) &&
10
- ZEROES=0000000000000000000000000000000000000000 &&
10
EMPTY_BLOB7=$(echo $EMPTY_BLOB | sed "s/\(.......\).*/\1/") &&
11
CHANGED_BLOB7=$(echo $CHANGED_BLOB | sed "s/\(.......\).*/\1/") &&
12
@@ -239,10 +238,10 @@ test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '
238
239
test_expect_success 'diff-index respects work tree under .git dir' '
240
cat >diff-index-cached.expected <<-EOF &&
242
- :000000 100644 $ZEROES $EMPTY_BLOB A sub/dir/tracked
241
+ :000000 100644 $_z40 $EMPTY_BLOB A sub/dir/tracked
242
EOF
243
cat >diff-index.expected <<-EOF &&
245
- :000000 100644 $ZEROES $ZEROES A sub/dir/tracked
244
+ :000000 100644 $_z40 $_z40 A sub/dir/tracked
245
EOF
246
247
(
@@ -258,7 +257,7 @@ test_expect_success 'diff-index respects work tree under .git dir' '
257
258
test_expect_success 'diff-files respects work tree under .git dir' '
259
cat >diff-files.expected <<-EOF &&
261
- :100644 100644 $EMPTY_BLOB $ZEROES M sub/dir/tracked
260
+ :100644 100644 $EMPTY_BLOB $_z40 M sub/dir/tracked
261
EOF
262
263
(
t/t2011-checkout-invalid-head.sh
+1
-1
@@ -15,7 +15,7 @@ test_expect_success 'checkout should not start branch from a tree' '
15
'
16
17
test_expect_success 'checkout master from invalid HEAD' '
18
- echo 0000000000000000000000000000000000000000 >.git/HEAD &&
18
+ echo $_z40 >.git/HEAD &&
19
git checkout master --
20
'
21
t/t2201-add-update-typechange.sh
-2
@@ -4,8 +4,6 @@ test_description='more git add -u'
4
5
. ./test-lib.sh
6
7
-_z40=0000000000000000000000000000000000000000
8
-
7
test_expect_success setup '
8
>xyzzy &&
9
_empty=$(git hash-object --stdin <xyzzy) &&
t/t3200-branch.sh
+2
-2
@@ -35,7 +35,7 @@ test_expect_success \
35
'git branch a/b/c && test -f .git/refs/heads/a/b/c'
36
37
cat >expect <<EOF
38
-0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
38
+$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
39
EOF
40
test_expect_success \
41
'git branch -l d/e/f should create a branch and a log' \
@@ -214,7 +214,7 @@ test_expect_success \
214
215
# Keep this test last, as it changes the current branch
216
cat >expect <<EOF
217
-0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
217
+$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
218
EOF
219
test_expect_success \
220
'git checkout -b g/h/i -l should create a branch and a log' \
t/t3600-rm.sh
+1
-2
@@ -240,11 +240,10 @@ test_expect_success 'refresh index before checking if it is up-to-date' '
240
241
test_expect_success 'choking "git rm" should not let it die with cruft' '
242
git reset -q --hard &&
243
- H=0000000000000000000000000000000000000000 &&
243
i=0 &&
244
while test $i -lt 12000
245
do
247
- echo "100644 $H 0 some-file-$i"
246
+ echo "100644 $_z40 0 some-file-$i"
247
i=$(( $i + 1 ))
248
done | git update-index --index-info &&
249
git rm -n "some-file-*" | :;
t/t4002-diff-basic.sh
+1
-4
@@ -126,15 +126,12 @@ cat >.test-recursive-AB <<\EOF
126
:100644 100644 3fdbe17fd013303a2e981e1ca1c6cd6e72789087 7e09d6a3a14bd630913e8c75693cea32157b606d M Z/NM
127
EOF
128
129
-x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
130
-x40="$x40$x40$x40$x40$x40$x40$x40$x40"
131
-z40='0000000000000000000000000000000000000000'
129
cmp_diff_files_output () {
130
# diff-files never reports additions. Also it does not fill in the
131
# object ID for the changed files because it wants you to look at the
132
# filesystem.
133
sed <"$2" >.test-tmp \
137
- -e '/^:000000 /d;s/'$x40'\( [MCRNDU][0-9]*\) /'$z40'\1 /' &&
134
+ -e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\) /'$_z40'\1 /' &&
135
test_cmp "$1" .test-tmp
136
}
137
t/t4020-diff-external.sh
-2
@@ -4,8 +4,6 @@ test_description='external diff interface test'
4
5
. ./test-lib.sh
6
7
-_z40=0000000000000000000000000000000000000000
8
-
7
test_expect_success setup '
8
9
test_tick &&
t/t4027-diff-submodule.sh
-1
@@ -5,7 +5,6 @@ test_description='difference in submodules'
5
. ./test-lib.sh
6
. "$TEST_DIRECTORY"/diff-lib.sh
7
8
-_z40=0000000000000000000000000000000000000000
8
test_expect_success setup '
9
test_tick &&
10
test_create_repo sub &&
t/t7011-skip-worktree-reading.sh
+2
-2
@@ -24,7 +24,7 @@ H sub/2
24
EOF
25
26
NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
27
-ZERO_SHA0=0000000000000000000000000000000000000000
27
+
28
setup_absent() {
29
test -f 1 && rm 1
30
git update-index --remove 1 &&
@@ -120,7 +120,7 @@ test_expect_success 'grep with skip-worktree file' '
120
test "$(git grep --no-ext-grep test)" = "1:test"
121
'
122
123
-echo ":000000 100644 $ZERO_SHA0 $NULL_SHA1 A 1" > expected
123
+echo ":000000 100644 $_z40 $NULL_SHA1 A 1" > expected
124
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
125
setup_absent &&
126
git diff-index HEAD -- 1 > result &&
t/t7012-skip-worktree-writing.sh
+1
-1
@@ -54,7 +54,7 @@ test_expect_success 'read-tree removes worktree, dirty case' '
54
'
55
56
NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
57
-ZERO_SHA0=0000000000000000000000000000000000000000
57
+
58
setup_absent() {
59
test -f 1 && rm 1
60
git update-index --remove 1 &&
t/test-lib.sh
+3
@@ -97,6 +97,9 @@ esac
97
_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
98
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
99
100
+# Zero SHA-1
101
+_z40=0000000000000000000000000000000000000000
102
+
103
# Each test should start with something like this, after copyright notices:
104
#
105
# test_description='Description of this test...