Browse Source

t5530: compute results based on object length

Compute the various pkt-line values based on the length of the object
IDs in use.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
brian m. carlson 5 years ago committed by Junio C Hamano
parent
commit
832072219c
  1. 26
      t/t5530-upload-pack-error.sh

26
t/t5530-upload-pack-error.sh

@ -14,7 +14,7 @@ corrupt_repo () { @@ -14,7 +14,7 @@ corrupt_repo () {
}

test_expect_success 'setup and corrupt repository' '

test_oid_init &&
echo file >file &&
git add file &&
git rev-parse :file &&
@ -31,9 +31,10 @@ test_expect_success 'fsck fails' ' @@ -31,9 +31,10 @@ test_expect_success 'fsck fails' '
'

test_expect_success 'upload-pack fails due to error in pack-objects packing' '

printf "0032want %s\n00000009done\n0000" \
$(git rev-parse HEAD) >input &&
head=$(git rev-parse HEAD) &&
hexsz=$(test_oid hexsz) &&
printf "%04xwant %s\n00000009done\n0000" \
$(($hexsz + 10)) $head >input &&
test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
test_i18ngrep "unable to read" output.err &&
test_i18ngrep "pack-objects died" output.err
@ -51,16 +52,17 @@ test_expect_success 'fsck fails' ' @@ -51,16 +52,17 @@ test_expect_success 'fsck fails' '
'
test_expect_success 'upload-pack fails due to error in rev-list' '

printf "0032want %s\n0034shallow %s00000009done\n0000" \
$(git rev-parse HEAD) $(git rev-parse HEAD^) >input &&
printf "%04xwant %s\n%04xshallow %s00000009done\n0000" \
$(($hexsz + 10)) $(git rev-parse HEAD) \
$(($hexsz + 12)) $(git rev-parse HEAD^) >input &&
test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
grep "bad tree object" output.err
'

test_expect_success 'upload-pack fails due to bad want (no object)' '

printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input &&
printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \
$(($hexsz + 29)) $(test_oid deadbeef) >input &&
test_must_fail git upload-pack . <input >output 2>output.err &&
grep "not our ref" output.err &&
grep "ERR" output &&
@ -70,8 +72,8 @@ test_expect_success 'upload-pack fails due to bad want (no object)' ' @@ -70,8 +72,8 @@ test_expect_success 'upload-pack fails due to bad want (no object)' '
test_expect_success 'upload-pack fails due to bad want (not tip)' '

oid=$(echo an object we have | git hash-object -w --stdin) &&
printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
"$oid" >input &&
printf "%04xwant %s multi_ack_detailed\n00000009done\n0000" \
$(($hexsz + 29)) "$oid" >input &&
test_must_fail git upload-pack . <input >output 2>output.err &&
grep "not our ref" output.err &&
grep "ERR" output &&
@ -80,8 +82,8 @@ test_expect_success 'upload-pack fails due to bad want (not tip)' ' @@ -80,8 +82,8 @@ test_expect_success 'upload-pack fails due to bad want (not tip)' '

test_expect_success 'upload-pack fails due to error in pack-objects enumeration' '

printf "0032want %s\n00000009done\n0000" \
$(git rev-parse HEAD) >input &&
printf "%04xwant %s\n00000009done\n0000" \
$((hexsz + 10)) $(git rev-parse HEAD) >input &&
test_must_fail git upload-pack . <input >/dev/null 2>output.err &&
grep "bad tree object" output.err &&
grep "pack-objects died" output.err

Loading…
Cancel
Save