Skip to content

Commit 3749fde

Browse files
committed
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 <[email protected]>
1 parent 87b5054 commit 3749fde

12 files changed

+15
-22
lines changed

t/t1400-update-ref.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
test_description='Test git update-ref and basic ref logging'
77
. ./test-lib.sh
88

9-
Z=0000000000000000000000000000000000000000
9+
Z=$_z40
1010

1111
test_expect_success setup '
1212

t/t1501-worktree.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ test_expect_success 'setup' '
77
EMPTY_TREE=$(git write-tree) &&
88
EMPTY_BLOB=$(git hash-object -t blob --stdin </dev/null) &&
99
CHANGED_BLOB=$(echo changed | git hash-object -t blob --stdin) &&
10-
ZEROES=0000000000000000000000000000000000000000 &&
1110
EMPTY_BLOB7=$(echo $EMPTY_BLOB | sed "s/\(.......\).*/\1/") &&
1211
CHANGED_BLOB7=$(echo $CHANGED_BLOB | sed "s/\(.......\).*/\1/") &&
1312
@@ -239,10 +238,10 @@ test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '
239238

240239
test_expect_success 'diff-index respects work tree under .git dir' '
241240
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
243242
EOF
244243
cat >diff-index.expected <<-EOF &&
245-
:000000 100644 $ZEROES $ZEROES A sub/dir/tracked
244+
:000000 100644 $_z40 $_z40 A sub/dir/tracked
246245
EOF
247246
248247
(
@@ -258,7 +257,7 @@ test_expect_success 'diff-index respects work tree under .git dir' '
258257

259258
test_expect_success 'diff-files respects work tree under .git dir' '
260259
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
262261
EOF
263262
264263
(

t/t2011-checkout-invalid-head.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test_expect_success 'checkout should not start branch from a tree' '
1515
'
1616

1717
test_expect_success 'checkout master from invalid HEAD' '
18-
echo 0000000000000000000000000000000000000000 >.git/HEAD &&
18+
echo $_z40 >.git/HEAD &&
1919
git checkout master --
2020
'
2121

t/t2201-add-update-typechange.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ test_description='more git add -u'
44

55
. ./test-lib.sh
66

7-
_z40=0000000000000000000000000000000000000000
8-
97
test_expect_success setup '
108
>xyzzy &&
119
_empty=$(git hash-object --stdin <xyzzy) &&

t/t3200-branch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test_expect_success \
3535
'git branch a/b/c && test -f .git/refs/heads/a/b/c'
3636

3737
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
3939
EOF
4040
test_expect_success \
4141
'git branch -l d/e/f should create a branch and a log' \
@@ -214,7 +214,7 @@ test_expect_success \
214214

215215
# Keep this test last, as it changes the current branch
216216
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
218218
EOF
219219
test_expect_success \
220220
'git checkout -b g/h/i -l should create a branch and a log' \

t/t3600-rm.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,10 @@ test_expect_success 'refresh index before checking if it is up-to-date' '
240240

241241
test_expect_success 'choking "git rm" should not let it die with cruft' '
242242
git reset -q --hard &&
243-
H=0000000000000000000000000000000000000000 &&
244243
i=0 &&
245244
while test $i -lt 12000
246245
do
247-
echo "100644 $H 0 some-file-$i"
246+
echo "100644 $_z40 0 some-file-$i"
248247
i=$(( $i + 1 ))
249248
done | git update-index --index-info &&
250249
git rm -n "some-file-*" | :;

t/t4002-diff-basic.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,12 @@ cat >.test-recursive-AB <<\EOF
126126
:100644 100644 3fdbe17fd013303a2e981e1ca1c6cd6e72789087 7e09d6a3a14bd630913e8c75693cea32157b606d M Z/NM
127127
EOF
128128

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'
132129
cmp_diff_files_output () {
133130
# diff-files never reports additions. Also it does not fill in the
134131
# object ID for the changed files because it wants you to look at the
135132
# filesystem.
136133
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 /' &&
138135
test_cmp "$1" .test-tmp
139136
}
140137

t/t4020-diff-external.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ test_description='external diff interface test'
44

55
. ./test-lib.sh
66

7-
_z40=0000000000000000000000000000000000000000
8-
97
test_expect_success setup '
108
119
test_tick &&

t/t4027-diff-submodule.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_description='difference in submodules'
55
. ./test-lib.sh
66
. "$TEST_DIRECTORY"/diff-lib.sh
77

8-
_z40=0000000000000000000000000000000000000000
98
test_expect_success setup '
109
test_tick &&
1110
test_create_repo sub &&

t/t7011-skip-worktree-reading.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ H sub/2
2424
EOF
2525

2626
NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
27-
ZERO_SHA0=0000000000000000000000000000000000000000
27+
2828
setup_absent() {
2929
test -f 1 && rm 1
3030
git update-index --remove 1 &&
@@ -120,7 +120,7 @@ test_expect_success 'grep with skip-worktree file' '
120120
test "$(git grep --no-ext-grep test)" = "1:test"
121121
'
122122

123-
echo ":000000 100644 $ZERO_SHA0 $NULL_SHA1 A 1" > expected
123+
echo ":000000 100644 $_z40 $NULL_SHA1 A 1" > expected
124124
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
125125
setup_absent &&
126126
git diff-index HEAD -- 1 > result &&

0 commit comments

Comments
 (0)