(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'errors in upload-pack'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:D) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.FuncDef name: corrupt_repo body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:object_sha1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(DQ ($ VSub_Number '$1'))})] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ob) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(expr)} {(DQ ($ VSub_DollarName '$object_sha1'))} {(Lit_Other ':')} {(DQ (Lit_Other '\\') ('(..') (Lit_Other '\\') (')'))} ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ject) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (C {(expr)} {(DQ ($ VSub_DollarName '$object_sha1'))} {(Lit_Other ':')} {(DQ (..) (Lit_Other '\\') ('(..*') (Lit_Other '\\') (')'))} ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (C {(rm)} {(-f)} {(DQ (.git/objects/) ($ VSub_DollarName '$ob') (/) ($ VSub_DollarName '$ject'))} ) ] ) ] ) ) (C {(test_expect_success)} {(SQ <'setup and corrupt repository'>)} { (SQ <'\n'> <'\n'> <'\techo file >file &&\n'> <'\tgit add file &&\n'> <'\tgit rev-parse :file &&\n'> <'\tgit commit -a -m original &&\n'> <'\ttest_tick &&\n'> <'\techo changed >file &&\n'> <'\tgit commit -a -m changed &&\n'> <'\tcorrupt_repo HEAD:file\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'fsck fails'>)} {(SQ <'\n'> <'\ttest_must_fail git fsck\n'>)}) (C {(test_expect_success)} {(SQ <'upload-pack fails due to error in pack-objects packing'>)} { (SQ <'\n'> <'\n'> <'\tprintf "0032want %s\\n00000009done\\n0000" \\\n'> <'\t\t$(git rev-parse HEAD) >input &&\n'> <'\ttest_must_fail git upload-pack . <input >/dev/null 2>output.err &&\n'> <'\ttest_i18ngrep "unable to read" output.err &&\n'> <'\ttest_i18ngrep "pack-objects died" output.err\n'> ) } ) (C {(test_expect_success)} {(SQ <'corrupt repo differently'>)} {(SQ <'\n'> <'\n'> <'\tgit hash-object -w file &&\n'> <'\tcorrupt_repo HEAD^^{tree}\n'> <'\n'>)} ) (C {(test_expect_success)} {(SQ <'fsck fails'>)} {(SQ <'\n'> <'\ttest_must_fail git fsck\n'>)}) (C {(test_expect_success)} {(SQ <'upload-pack fails due to error in rev-list'>)} { (SQ <'\n'> <'\n'> <'\tprintf "0032want %s\\n0034shallow %s00000009done\\n0000" \\\n'> <'\t\t$(git rev-parse HEAD) $(git rev-parse HEAD^) >input &&\n'> <'\ttest_must_fail git upload-pack . <input >/dev/null 2>output.err &&\n'> <'\tgrep "bad tree object" output.err\n'> ) } ) (C {(test_expect_success)} {(SQ <'upload-pack error message when bad ref requested'>)} { (SQ <'\n'> <'\n'> <'\tprintf "0045want %s multi_ack_detailed\\n00000009done\\n0000" \\\n'> <'\t\t"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input &&\n'> <'\ttest_must_fail git upload-pack . <input >output 2>output.err &&\n'> <'\tgrep -q "not our ref" output.err &&\n'> <'\t! grep -q multi_ack_detailed output.err\n'> ) } ) (C {(test_expect_success)} {(SQ <'upload-pack fails due to error in pack-objects enumeration'>)} { (SQ <'\n'> <'\n'> <'\tprintf "0032want %s\\n00000009done\\n0000" \\\n'> <'\t\t$(git rev-parse HEAD) >input &&\n'> <'\ttest_must_fail git upload-pack . <input >/dev/null 2>output.err &&\n'> <'\tgrep "bad tree object" output.err &&\n'> <'\tgrep "pack-objects died" output.err\n'> ) } ) (C {(test_expect_success)} {(SQ <'create empty repository'>)} {(SQ <'\n'> <'\n'> <'\tmkdir foo &&\n'> <'\tcd foo &&\n'> <'\tgit init\n'> <'\n'>)} ) (C {(test_expect_success)} {(SQ <'fetch fails'>)} {(SQ <'\n'> <'\n'> <'\ttest_must_fail git fetch .. master\n'> <'\n'>)} ) (C {(test_done)}) ] )