1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 19:36:14 +02:00

t: switch $_z40 to $ZERO_OID

Switch all uses of $_z40 to $ZERO_OID so that they work correctly with
larger hashes.  This commit was created by using the following sed
command to modify all files in the t directory except t/test-lib.sh:

  sed -i 's/\$_z40/$ZERO_OID/g'

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson 2018-05-13 02:24:13 +00:00 committed by Junio C Hamano
parent 198857bf7e
commit 8125a58b91
32 changed files with 119 additions and 119 deletions

View File

@ -236,8 +236,8 @@ test_expect_success "--batch-check for an empty line" '
'
test_expect_success 'empty --batch-check notices missing object' '
echo "$_z40 missing" >expect &&
echo "$_z40" | git cat-file --batch-check="" >actual &&
echo "$ZERO_OID missing" >expect &&
echo "$ZERO_OID" | git cat-file --batch-check="" >actual &&
test_cmp expect actual
'
@ -294,8 +294,8 @@ test_expect_success 'setup blobs which are likely to delta' '
test_expect_success 'confirm that neither loose blob is a delta' '
cat >expect <<-EOF &&
$_z40
$_z40
$ZERO_OID
$ZERO_OID
EOF
git cat-file --batch-check="%(deltabase)" <blobs >actual &&
test_cmp expect actual

View File

@ -6,7 +6,7 @@
test_description='Test git update-ref and basic ref logging'
. ./test-lib.sh
Z=$_z40
Z=$ZERO_OID
m=refs/heads/master
n_dir=refs/heads/gu

View File

@ -50,13 +50,13 @@ test_expect_success 'create_symref(FOO, refs/heads/master)' '
'
test_expect_success 'for_each_reflog()' '
echo $_z40 > .git/logs/PSEUDO-MAIN &&
echo $ZERO_OID > .git/logs/PSEUDO-MAIN &&
mkdir -p .git/logs/refs/bisect &&
echo $_z40 > .git/logs/refs/bisect/random &&
echo $ZERO_OID > .git/logs/refs/bisect/random &&
echo $_z40 > .git/worktrees/wt/logs/PSEUDO-WT &&
echo $ZERO_OID > .git/worktrees/wt/logs/PSEUDO-WT &&
mkdir -p .git/worktrees/wt/logs/refs/bisect &&
echo $_z40 > .git/worktrees/wt/logs/refs/bisect/wt-random &&
echo $ZERO_OID > .git/worktrees/wt/logs/refs/bisect/wt-random &&
$RWT for-each-reflog | cut -c 42- | sort >actual &&
cat >expected <<-\EOF &&

View File

@ -713,7 +713,7 @@ test_expect_success 'fsck notices dangling objects' '
test_expect_success 'fsck $name notices bogus $name' '
test_must_fail git fsck bogus &&
test_must_fail git fsck $_z40
test_must_fail git fsck $ZERO_OID
'
test_expect_success 'bogus head does not fallback to all heads' '
@ -723,7 +723,7 @@ test_expect_success 'bogus head does not fallback to all heads' '
blob=$(git rev-parse :foo) &&
test_when_finished "git rm --cached foo" &&
remove_object $blob &&
test_must_fail git fsck $_z40 >out 2>&1 &&
test_must_fail git fsck $ZERO_OID >out 2>&1 &&
! grep $blob out
'

View File

@ -238,10 +238,10 @@ test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '
test_expect_success 'diff-index respects work tree under .git dir' '
cat >diff-index-cached.expected <<-EOF &&
:000000 100644 $_z40 $EMPTY_BLOB A sub/dir/tracked
:000000 100644 $ZERO_OID $EMPTY_BLOB A sub/dir/tracked
EOF
cat >diff-index.expected <<-EOF &&
:000000 100644 $_z40 $_z40 A sub/dir/tracked
:000000 100644 $ZERO_OID $ZERO_OID A sub/dir/tracked
EOF
(
@ -257,7 +257,7 @@ test_expect_success 'diff-index respects work tree under .git dir' '
test_expect_success 'diff-files respects work tree under .git dir' '
cat >diff-files.expected <<-EOF &&
:100644 100644 $EMPTY_BLOB $_z40 M sub/dir/tracked
:100644 100644 $EMPTY_BLOB $ZERO_OID M sub/dir/tracked
EOF
(

View File

@ -4,7 +4,7 @@ test_description='test handling of bogus index entries'
. ./test-lib.sh
test_expect_success 'create tree with null sha1' '
tree=$(printf "160000 commit $_z40\\tbroken\\n" | git mktree)
tree=$(printf "160000 commit $ZERO_OID\\tbroken\\n" | git mktree)
'
test_expect_success 'read-tree refuses to read null sha1' '

View File

@ -426,7 +426,7 @@ test_expect_success 'writing split index with null sha1 does not write cache tre
git commit -m "commit" &&
{
git ls-tree HEAD &&
printf "160000 commit $_z40\\tbroken\\n"
printf "160000 commit $ZERO_OID\\tbroken\\n"
} >broken-tree &&
echo "add broken entry" >msg &&

View File

@ -15,7 +15,7 @@ test_expect_success 'checkout should not start branch from a tree' '
'
test_expect_success 'checkout master from invalid HEAD' '
echo $_z40 >.git/HEAD &&
echo $ZERO_OID >.git/HEAD &&
git checkout master --
'

View File

@ -465,7 +465,7 @@ post_checkout_hook () {
test_expect_success '"add" invokes post-checkout hook (branch)' '
post_checkout_hook &&
{
echo $_z40 $(git rev-parse HEAD) 1 &&
echo $ZERO_OID $(git rev-parse HEAD) 1 &&
echo $(pwd)/.git/worktrees/gumby &&
echo $(pwd)/gumby
} >hook.expect &&
@ -476,7 +476,7 @@ test_expect_success '"add" invokes post-checkout hook (branch)' '
test_expect_success '"add" invokes post-checkout hook (detached)' '
post_checkout_hook &&
{
echo $_z40 $(git rev-parse HEAD) 1 &&
echo $ZERO_OID $(git rev-parse HEAD) 1 &&
echo $(pwd)/.git/worktrees/grumpy &&
echo $(pwd)/grumpy
} >hook.expect &&
@ -494,7 +494,7 @@ test_expect_success '"add --no-checkout" suppresses post-checkout hook' '
test_expect_success '"add" in other worktree invokes post-checkout hook' '
post_checkout_hook &&
{
echo $_z40 $(git rev-parse HEAD) 1 &&
echo $ZERO_OID $(git rev-parse HEAD) 1 &&
echo $(pwd)/.git/worktrees/guppy &&
echo $(pwd)/guppy
} >hook.expect &&
@ -506,7 +506,7 @@ test_expect_success '"add" in bare repo invokes post-checkout hook' '
rm -rf bare &&
git clone --bare . bare &&
{
echo $_z40 $(git --git-dir=bare rev-parse HEAD) 1 &&
echo $ZERO_OID $(git --git-dir=bare rev-parse HEAD) 1 &&
echo $(pwd)/bare/worktrees/goozy &&
echo $(pwd)/goozy
} >hook.expect &&

View File

@ -116,7 +116,7 @@ test_expect_success 'broken main worktree still at the top' '
git worktree add linked &&
cat >expected <<-EOF &&
worktree $(pwd)
HEAD $_z40
HEAD $ZERO_OID
EOF
cd linked &&

View File

@ -37,7 +37,7 @@ test_expect_success '--cacheinfo does not accept blob null sha1' '
echo content >file &&
git add file &&
git rev-parse :file >expect &&
test_must_fail git update-index --cacheinfo 100644 $_z40 file &&
test_must_fail git update-index --cacheinfo 100644 $ZERO_OID file &&
git rev-parse :file >actual &&
test_cmp expect actual
'
@ -47,7 +47,7 @@ test_expect_success '--cacheinfo does not accept gitlink null sha1' '
(cd submodule && test_commit foo) &&
git add submodule &&
git rev-parse :submodule >expect &&
test_must_fail git update-index --cacheinfo 160000 $_z40 submodule &&
test_must_fail git update-index --cacheinfo 160000 $ZERO_OID submodule &&
git rev-parse :submodule >actual &&
test_cmp expect actual
'

View File

@ -75,35 +75,35 @@ test_expect_success modify '
git ls-tree -r HEAD |
sed -e "s/^/:/" -e "
/ caskly/{
s/ caskly/ $_z40 D&/
s/ caskly/ $ZERO_OID D&/
s/blob/000000/
}
/ nitfol/{
s/ nitfol/ $_z40 $T_letter&/
s/ nitfol/ $ZERO_OID $T_letter&/
s/blob/100644/
}
/ rezrov.bozbar/{
s/ rezrov.bozbar/ $_z40 D&/
s/ rezrov.bozbar/ $ZERO_OID D&/
s/blob/000000/
}
/ xyzzy/{
s/ xyzzy/ $_z40 D&/
s/ xyzzy/ $ZERO_OID D&/
s/blob/000000/
}
/ yomin/{
s/ yomin/ $_z40 T&/
s/ yomin/ $ZERO_OID T&/
s/blob/160000/
}
"
} >expect &&
{
cat expect
echo ":100644 160000 $_empty $_z40 T yonk"
echo ":100644 000000 $_empty $_z40 D zifmia"
echo ":100644 160000 $_empty $ZERO_OID T yonk"
echo ":100644 000000 $_empty $ZERO_OID D zifmia"
} >expect-files &&
{
cat expect
echo ":000000 160000 $_z40 $_z40 A yonk"
echo ":000000 160000 $ZERO_OID $ZERO_OID A yonk"
} >expect-index &&
{
echo "100644 $_empty 0 nitfol"

View File

@ -30,9 +30,9 @@ test_expect_success 'git status with porcelain v2' '
nam1=d00491fd7e5bb6fa28c517a0bb32b8b506539d4d &&
nam2=ce013625030ba8dba906f756967f9e9ca394464a &&
cat >expect <<-EOF &&
1 DA N... 100644 000000 100644 $nam1 $_z40 1.t
1 A. N... 000000 100644 100644 $_z40 $nam2 elif
1 .A N... 000000 000000 100644 $_z40 $_z40 file
1 DA N... 100644 000000 100644 $nam1 $ZERO_OID 1.t
1 A. N... 000000 100644 100644 $ZERO_OID $nam2 elif
1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID file
EOF
test_cmp expect actual
'

View File

@ -47,7 +47,7 @@ test_expect_success 'git branch HEAD should fail' '
'
cat >expect <<EOF
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
EOF
test_expect_success 'git branch -l d/e/f should create a branch and a log' '
GIT_COMMITTER_DATE="2005-05-26 23:30" \
@ -901,7 +901,7 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups
# Keep this test last, as it changes the current branch
cat >expect <<EOF
$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
EOF
test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' '
GIT_COMMITTER_DATE="2005-05-26 23:30" \

View File

@ -131,7 +131,7 @@ cmp_diff_files_output () {
# object ID for the changed files because it wants you to look at the
# filesystem.
sed <"$2" >.test-tmp \
-e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\) /'$_z40'\1 /' &&
-e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\) /'$ZERO_OID'\1 /' &&
test_cmp "$1" .test-tmp
}

View File

@ -1523,7 +1523,7 @@ test_expect_success 'cover letter auto user override' '
test_expect_success 'format-patch --zero-commit' '
git format-patch --zero-commit --stdout v2..v1 >patch2 &&
grep "^From " patch2 | sort | uniq >actual &&
echo "From $_z40 Mon Sep 17 00:00:00 2001" >expect &&
echo "From $ZERO_OID Mon Sep 17 00:00:00 2001" >expect &&
test_cmp expect actual
'

View File

@ -26,7 +26,7 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment' '
read path oldfile oldhex oldmode newfile newhex newmode &&
test "z$path" = zfile &&
test "z$oldmode" = z100644 &&
test "z$newhex" = "z$_z40" &&
test "z$newhex" = "z$ZERO_OID" &&
test "z$newmode" = z100644 &&
oh=$(git rev-parse --verify HEAD:file) &&
test "z$oh" = "z$oldhex"
@ -55,7 +55,7 @@ test_expect_success SYMLINKS 'typechange diff' '
read path oldfile oldhex oldmode newfile newhex newmode &&
test "z$path" = zfile &&
test "z$oldmode" = z100644 &&
test "z$newhex" = "z$_z40" &&
test "z$newhex" = "z$ZERO_OID" &&
test "z$newmode" = z120000 &&
oh=$(git rev-parse --verify HEAD:file) &&
test "z$oh" = "z$oldhex"
@ -73,7 +73,7 @@ test_expect_success 'diff.external' '
read path oldfile oldhex oldmode newfile newhex newmode &&
test "z$path" = zfile &&
test "z$oldmode" = z100644 &&
test "z$newhex" = "z$_z40" &&
test "z$newhex" = "z$ZERO_OID" &&
test "z$newmode" = z100644 &&
oh=$(git rev-parse --verify HEAD:file) &&
test "z$oh" = "z$oldhex"
@ -104,7 +104,7 @@ test_expect_success 'diff attribute' '
read path oldfile oldhex oldmode newfile newhex newmode &&
test "z$path" = zfile &&
test "z$oldmode" = z100644 &&
test "z$newhex" = "z$_z40" &&
test "z$newhex" = "z$ZERO_OID" &&
test "z$newmode" = z100644 &&
oh=$(git rev-parse --verify HEAD:file) &&
test "z$oh" = "z$oldhex"
@ -137,7 +137,7 @@ test_expect_success 'diff attribute' '
read path oldfile oldhex oldmode newfile newhex newmode &&
test "z$path" = zfile &&
test "z$oldmode" = z100644 &&
test "z$newhex" = "z$_z40" &&
test "z$newhex" = "z$ZERO_OID" &&
test "z$newmode" = z100644 &&
oh=$(git rev-parse --verify HEAD:file) &&
test "z$oh" = "z$oldhex"

View File

@ -31,7 +31,7 @@ test_expect_success setup '
cd sub &&
git rev-list HEAD
) &&
echo ":160000 160000 $3 $_z40 M sub" >expect &&
echo ":160000 160000 $3 $ZERO_OID M sub" >expect &&
subtip=$3 subprev=$2
'
@ -250,7 +250,7 @@ test_expect_success 'conflicted submodule setup' '
# 39 efs
c=fffffffffffffffffffffffffffffffffffffff &&
(
echo "000000 $_z40 0 sub" &&
echo "000000 $ZERO_OID 0 sub" &&
echo "160000 1$c 1 sub" &&
echo "160000 2$c 2 sub" &&
echo "160000 3$c 3 sub"
@ -265,7 +265,7 @@ index 2ffffff,3ffffff..0000000
++Subproject commit 0000000000000000000000000000000000000000'\'' &&
hh=$(git rev-parse HEAD) &&
sed -e "s/$_z40/$hh/" expect.nosub >expect.withsub
sed -e "s/$ZERO_OID/$hh/" expect.nosub >expect.withsub
'

View File

@ -37,7 +37,7 @@ test_expect_success 'diff-files -0' '
for path in $paths
do
>"$path" &&
echo ":000000 100644 $_z40 $_z40 U $path"
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path"
done >diff-files-0.expect &&
git diff-files -0 >diff-files-0.actual &&
test_cmp diff-files-0.expect diff-files-0.actual
@ -47,9 +47,9 @@ test_expect_success 'diff-files -1' '
for path in $paths
do
>"$path" &&
echo ":000000 100644 $_z40 $_z40 U $path" &&
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
case "$path" in
x??) echo ":100644 100644 $blob1 $_z40 M $path"
x??) echo ":100644 100644 $blob1 $ZERO_OID M $path"
esac
done >diff-files-1.expect &&
git diff-files -1 >diff-files-1.actual &&
@ -60,9 +60,9 @@ test_expect_success 'diff-files -2' '
for path in $paths
do
>"$path" &&
echo ":000000 100644 $_z40 $_z40 U $path" &&
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
case "$path" in
?x?) echo ":100644 100644 $blob2 $_z40 M $path"
?x?) echo ":100644 100644 $blob2 $ZERO_OID M $path"
esac
done >diff-files-2.expect &&
git diff-files -2 >diff-files-2.actual &&
@ -75,9 +75,9 @@ test_expect_success 'diff-files -3' '
for path in $paths
do
>"$path" &&
echo ":000000 100644 $_z40 $_z40 U $path" &&
echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" &&
case "$path" in
??x) echo ":100644 100644 $blob3 $_z40 M $path"
??x) echo ":100644 100644 $blob3 $ZERO_OID M $path"
esac
done >diff-files-3.expect &&
git diff-files -3 >diff-files-3.actual &&

View File

@ -19,37 +19,37 @@ test_expect_success 'create tree with matching file' '
'
test_expect_success 'raw diff shows null sha1 (addition)' '
echo ":000000 100644 $_z40 $_z40 A foo" >expect &&
echo ":000000 100644 $ZERO_OID $ZERO_OID A foo" >expect &&
git diff-tree $EMPTY_TREE $bogus_tree >actual &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (removal)' '
echo ":100644 000000 $_z40 $_z40 D foo" >expect &&
echo ":100644 000000 $ZERO_OID $ZERO_OID D foo" >expect &&
git diff-tree $bogus_tree $EMPTY_TREE >actual &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (modification)' '
echo ":100644 100644 $blob $_z40 M foo" >expect &&
echo ":100644 100644 $blob $ZERO_OID M foo" >expect &&
git diff-tree $good_tree $bogus_tree >actual &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (other direction)' '
echo ":100644 100644 $_z40 $blob M foo" >expect &&
echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
git diff-tree $bogus_tree $good_tree >actual &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (reverse)' '
echo ":100644 100644 $_z40 $blob M foo" >expect &&
echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
git diff-tree -R $good_tree $bogus_tree >actual &&
test_cmp expect actual
'
test_expect_success 'raw diff shows null sha1 (index)' '
echo ":100644 100644 $_z40 $blob M foo" >expect &&
echo ":100644 100644 $ZERO_OID $blob M foo" >expect &&
git diff-index $bogus_tree >actual &&
test_cmp expect actual
'

View File

@ -59,12 +59,12 @@ test_expect_success 'create trees with duplicate entries' '
test_expect_success 'diff-tree between trees' '
{
printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
printf ":000000 100644 $_z40 $blob_two A\touter/inner\n" &&
printf ":100644 000000 $blob_two $_z40 D\touter/inner\n" &&
printf ":100644 000000 $blob_two $_z40 D\touter/inner\n" &&
printf ":100644 000000 $blob_two $_z40 D\touter/inner\n"
printf ":000000 100644 $ZERO_OID $blob_two A\touter/inner\n" &&
printf ":000000 100644 $ZERO_OID $blob_two A\touter/inner\n" &&
printf ":000000 100644 $ZERO_OID $blob_two A\touter/inner\n" &&
printf ":100644 000000 $blob_two $ZERO_OID D\touter/inner\n" &&
printf ":100644 000000 $blob_two $ZERO_OID D\touter/inner\n" &&
printf ":100644 000000 $blob_two $ZERO_OID D\touter/inner\n"
} >expect &&
git diff-tree -r --no-abbrev one two >actual &&
test_cmp expect actual

View File

@ -140,8 +140,8 @@ test_expect_success setup '
echo "# User $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" &&
echo "# Date $test_tick 25200" &&
echo "# $(git show --pretty="%aD" -s second)" &&
echo "# Node ID $_z40" &&
echo "# Parent $_z40" &&
echo "# Node ID $ZERO_OID" &&
echo "# Parent $ZERO_OID" &&
cat msg &&
echo &&
git diff-tree --no-commit-id -p second

View File

@ -243,7 +243,7 @@ rerere_gc_custom_expiry_test () {
five_days="$1" right_now="$2"
test_expect_success "rerere gc with custom expiry ($five_days, $right_now)" '
rm -fr .git/rr-cache &&
rr=.git/rr-cache/$_z40 &&
rr=.git/rr-cache/$ZERO_OID &&
mkdir -p "$rr" &&
>"$rr/preimage" &&
>"$rr/postimage" &&

View File

@ -634,7 +634,7 @@ test_expect_success 'pushing valid refs triggers post-receive and post-update ho
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
newmaster=$(git show-ref -s --verify refs/heads/master) &&
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
newnext=$_z40 &&
newnext=$ZERO_OID &&
git push testrepo refs/heads/master:refs/heads/master :refs/heads/next &&
(
cd testrepo/.git &&
@ -672,15 +672,15 @@ test_expect_success 'deleting dangling ref triggers hooks with correct args' '
(
cd testrepo/.git &&
cat >pre-receive.expect <<-EOF &&
$_z40 $_z40 refs/heads/master
$ZERO_OID $ZERO_OID refs/heads/master
EOF
cat >update.expect <<-EOF &&
refs/heads/master $_z40 $_z40
refs/heads/master $ZERO_OID $ZERO_OID
EOF
cat >post-receive.expect <<-EOF &&
$_z40 $_z40 refs/heads/master
$ZERO_OID $ZERO_OID refs/heads/master
EOF
cat >post-update.expect <<-EOF &&
@ -703,12 +703,12 @@ test_expect_success 'deletion of a non-existent ref is not fed to post-receive a
cd testrepo/.git &&
cat >pre-receive.expect <<-EOF &&
$orgmaster $newmaster refs/heads/master
$_z40 $_z40 refs/heads/nonexistent
$ZERO_OID $ZERO_OID refs/heads/nonexistent
EOF
cat >update.expect <<-EOF &&
refs/heads/master $orgmaster $newmaster
refs/heads/nonexistent $_z40 $_z40
refs/heads/nonexistent $ZERO_OID $ZERO_OID
EOF
cat >post-receive.expect <<-EOF &&
@ -732,11 +732,11 @@ test_expect_success 'deletion of a non-existent ref alone does trigger post-rece
(
cd testrepo/.git &&
cat >pre-receive.expect <<-EOF &&
$_z40 $_z40 refs/heads/nonexistent
$ZERO_OID $ZERO_OID refs/heads/nonexistent
EOF
cat >update.expect <<-EOF &&
refs/heads/nonexistent $_z40 $_z40
refs/heads/nonexistent $ZERO_OID $ZERO_OID
EOF
test_cmp pre-receive.expect pre-receive.actual &&
@ -751,7 +751,7 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
newmaster=$(git show-ref -s --verify refs/heads/master) &&
orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
newnext=$_z40 &&
newnext=$ZERO_OID &&
orgpu=$(cd testrepo && git show-ref -s --verify refs/heads/pu) &&
newpu=$(git show-ref -s --verify refs/heads/master) &&
git push testrepo refs/heads/master:refs/heads/master \
@ -763,14 +763,14 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
$orgmaster $newmaster refs/heads/master
$orgnext $newnext refs/heads/next
$orgpu $newpu refs/heads/pu
$_z40 $_z40 refs/heads/nonexistent
$ZERO_OID $ZERO_OID refs/heads/nonexistent
EOF
cat >update.expect <<-EOF &&
refs/heads/master $orgmaster $newmaster
refs/heads/next $orgnext $newnext
refs/heads/pu $orgpu $newpu
refs/heads/nonexistent $_z40 $_z40
refs/heads/nonexistent $ZERO_OID $ZERO_OID
EOF
cat >post-receive.expect <<-EOF &&

View File

@ -27,7 +27,7 @@ test_expect_success 'suffix ref is ignored during fetch' '
'
test_expect_success 'try to create repo with absurdly long refname' '
ref240=$_z40/$_z40/$_z40/$_z40/$_z40/$_z40 &&
ref240=$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID &&
ref1440=$ref240/$ref240/$ref240/$ref240/$ref240/$ref240 &&
git init long &&
(

View File

@ -78,8 +78,8 @@ test_expect_success 'push to default' '
cat >expected <<EOF
parent1
repo1
refs/tags/one $COMMIT1 refs/tags/tag1 $_z40
HEAD~ $COMMIT2 refs/heads/prev $_z40
refs/tags/one $COMMIT1 refs/tags/tag1 $ZERO_OID
HEAD~ $COMMIT2 refs/heads/prev $ZERO_OID
EOF
test_expect_success 'push non-branches' '
@ -90,7 +90,7 @@ test_expect_success 'push non-branches' '
cat >expected <<EOF
parent1
repo1
(delete) $_z40 refs/heads/prev $COMMIT2
(delete) $ZERO_OID refs/heads/prev $COMMIT2
EOF
test_expect_success 'push delete' '
@ -101,7 +101,7 @@ test_expect_success 'push delete' '
cat >expected <<EOF
repo1
repo1
HEAD $COMMIT3 refs/heads/other $_z40
HEAD $COMMIT3 refs/heads/other $ZERO_OID
EOF
test_expect_success 'push to URL' '

View File

@ -383,7 +383,7 @@ test_expect_success 'describe complains about tree object' '
'
test_expect_success 'describe complains about missing object' '
test_must_fail git describe $_z40
test_must_fail git describe $ZERO_OID
'
test_done

View File

@ -310,7 +310,7 @@ test_expect_success 'exercise strftime with odd fields' '
echo >expected &&
git for-each-ref --format="%(authordate:format:)" refs/heads >actual &&
test_cmp expected actual &&
long="long format -- $_z40$_z40$_z40$_z40$_z40$_z40$_z40" &&
long="long format -- $ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID$ZERO_OID" &&
echo $long >expected &&
git for-each-ref --format="%(authordate:format:$long)" refs/heads >actual &&
test_cmp expected actual

View File

@ -4,7 +4,7 @@ test_description='for-each-ref errors for broken refs'
. ./test-lib.sh
ZEROS=$_z40
ZEROS=$ZERO_OID
MISSING=abababababababababababababababababababab
test_expect_success setup '

View File

@ -12,7 +12,7 @@ test_expect_success 'setup: base commits' '
test_expect_success 'setup: a commit with a bogus null sha1 in the tree' '
{
git ls-tree HEAD &&
printf "160000 commit $_z40\\tbroken\\n"
printf "160000 commit $ZERO_OID\\tbroken\\n"
} >broken-tree &&
echo "add broken entry" >msg &&

View File

@ -118,7 +118,7 @@ test_expect_success 'grep with skip-worktree file' '
test "$(git grep --no-ext-grep test)" = "1:test"
'
echo ":000000 100644 $_z40 $EMPTY_BLOB A 1" > expected
echo ":000000 100644 $ZERO_OID $EMPTY_BLOB A 1" > expected
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
setup_absent &&
git diff-index HEAD -- 1 > result &&

View File

@ -46,11 +46,11 @@ test_expect_success 'before initial commit, things added' '
cat >expect <<-EOF &&
# branch.oid (initial)
# branch.head master
1 A. N... 000000 100644 100644 $_z40 $OID_A dir1/file_a
1 A. N... 000000 100644 100644 $_z40 $OID_B dir1/file_b
1 A. N... 000000 100644 100644 $_z40 $OID_X file_x
1 A. N... 000000 100644 100644 $_z40 $OID_Y file_y
1 A. N... 000000 100644 100644 $_z40 $OID_Z file_z
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Y file_y
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Z file_z
? actual
? expect
EOF
@ -63,11 +63,11 @@ test_expect_success 'before initial commit, things added (-z)' '
lf_to_nul >expect <<-EOF &&
# branch.oid (initial)
# branch.head master
1 A. N... 000000 100644 100644 $_z40 $OID_A dir1/file_a
1 A. N... 000000 100644 100644 $_z40 $OID_B dir1/file_b
1 A. N... 000000 100644 100644 $_z40 $OID_X file_x
1 A. N... 000000 100644 100644 $_z40 $OID_Y file_y
1 A. N... 000000 100644 100644 $_z40 $OID_Z file_z
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Y file_y
1 A. N... 000000 100644 100644 $ZERO_OID $OID_Z file_z
? actual
? expect
EOF
@ -128,7 +128,7 @@ test_expect_success 'after first commit, stage existing changes' '
# branch.oid $H0
# branch.head master
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
? actual
? expect
EOF
@ -145,7 +145,7 @@ test_expect_success 'rename causes 2 path lines' '
# branch.oid $H0
# branch.head master
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
? actual
? expect
@ -163,7 +163,7 @@ test_expect_success 'rename causes 2 path lines (-z)' '
# branch.oid $H0
# branch.head master
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
? actual
? expect
@ -246,8 +246,8 @@ test_expect_success 'verify --intent-to-add output' '
git add --intent-to-add intent1.add intent2.add &&
cat >expect <<-EOF &&
1 .A N... 000000 000000 100644 $_z40 $_z40 intent1.add
1 .A N... 000000 000000 100644 $_z40 $_z40 intent2.add
1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID intent1.add
1 .A N... 000000 000000 100644 $ZERO_OID $ZERO_OID intent2.add
EOF
git status --porcelain=v2 >actual &&
@ -280,7 +280,7 @@ test_expect_success 'verify AA (add-add) conflict' '
cat >expect <<-EOF &&
# branch.oid $HM
# branch.head AA_M
u AA N... 000000 100644 100644 100644 $_z40 $OID_AA_B $OID_AA_A conflict.txt
u AA N... 000000 100644 100644 100644 $ZERO_OID $OID_AA_B $OID_AA_A conflict.txt
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -373,7 +373,7 @@ test_expect_success 'verify upstream fields in branch header' '
## Test upstream-gone case. Fake this by pointing origin/master at
## a non-existing commit.
OLD=$(git rev-parse origin/master) &&
NEW=$_z40 &&
NEW=$ZERO_OID &&
mv .git/packed-refs .git/old-packed-refs &&
sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
@ -469,8 +469,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 A. S... 000000 160000 160000 $_z40 $HSUB sub1
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -494,8 +494,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S..U 000000 160000 160000 $_z40 $HSUB sub1
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -519,8 +519,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' '
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $_z40 $HSUB sub1
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -546,8 +546,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' '
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $_z40 $HSUB sub1
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -573,8 +573,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)'
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM S.MU 000000 160000 160000 $_z40 $HSUB sub1
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -600,8 +600,8 @@ test_expect_success 'commit within the submodule appears as new commit in super
# branch.head master
# branch.upstream origin/master
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $_z40 $HMOD .gitmodules
1 AM SC.. 000000 160000 160000 $_z40 $HSUB sub1
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&