diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-22T16·46+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-22T16·46+0100 |
commit | 5229c9b232de5bfa959ad6ebbb4c8192ac513352 (patch) | |
tree | 8539e7e23682cac110900f946f034ae44162cacd /third_party/git/t/t5530-upload-pack-error.sh | |
parent | f2b211131f2347342dde63975b09cf603149f1a3 (diff) | |
parent | 8518a7a51faaf50f830646d4c3585f51236b9349 (diff) |
merge(3p/git): Merge git upstream at v2.26.2 r/808
Diffstat (limited to 'third_party/git/t/t5530-upload-pack-error.sh')
-rwxr-xr-x | third_party/git/t/t5530-upload-pack-error.sh | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/third_party/git/t/t5530-upload-pack-error.sh b/third_party/git/t/t5530-upload-pack-error.sh index a1d3031d40dc..4ce9a9f70411 100755 --- a/third_party/git/t/t5530-upload-pack-error.sh +++ b/third_party/git/t/t5530-upload-pack-error.sh @@ -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' ' ' 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' ' ' 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)' ' 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)' ' 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 |