(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Test that adding/removing many notes triggers automatic fanout restructuring'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'creating many notes with git-notes'>)} { (SQ <'\n'> <'\tnum_notes=300 &&\n'> <'\ti=0 &&\n'> <'\twhile test $i -lt $num_notes\n'> <'\tdo\n'> <'\t\ti=$(($i + 1)) &&\n'> <'\t\ttest_tick &&\n'> <'\t\techo "file for commit #$i" > file &&\n'> <'\t\tgit add file &&\n'> <'\t\tgit commit -q -m "commit #$i" &&\n'> <'\t\tgit notes add -m "note #$i" || return 1\n'> <'\tdone\n'> ) } ) (C {<test_expect_success>} {(SQ <'many notes created correctly with git-notes'>)} { (SQ <'\n'> <'\tgit log | grep "^ " > output &&\n'> <'\ti=300 &&\n'> <'\twhile test $i -gt 0\n'> <'\tdo\n'> <'\t\techo " commit #$i" &&\n'> <'\t\techo " note #$i" &&\n'> <'\t\ti=$(($i - 1));\n'> <'\tdone > expect &&\n'> <'\ttest_cmp expect output\n'> ) } ) (C {<test_expect_success>} {(SQ <'many notes created with git-notes triggers fanout'>)} { (SQ <'\n'> <'\t# Expect entire notes tree to have a fanout == 1\n'> <'\tgit ls-tree -r --name-only refs/notes/commits |\n'> <'\twhile read path\n'> <'\tdo\n'> <'\t\tcase "$path" in\n'> <'\t\t??/??????????????????????????????????????)\n'> <'\t\t\t: true\n'> <'\t\t\t;;\n'> <'\t\t*)\n'> <'\t\t\techo "Invalid path \\"$path\\"" &&\n'> <'\t\t\treturn 1\n'> <'\t\t\t;;\n'> <'\t\tesac\n'> <'\tdone\n'> ) } ) (C {<test_expect_success>} {(SQ <'deleting most notes with git-notes'>)} { (SQ <'\n'> <'\tnum_notes=250 &&\n'> <'\ti=0 &&\n'> <'\tgit rev-list HEAD |\n'> <'\twhile test $i -lt $num_notes && read sha1\n'> <'\tdo\n'> <'\t\ti=$(($i + 1)) &&\n'> <'\t\ttest_tick &&\n'> <'\t\tgit notes remove "$sha1" ||\n'> <'\t\texit 1\n'> <'\tdone\n'> ) } ) (C {<test_expect_success>} {(SQ <'most notes deleted correctly with git-notes'>)} { (SQ <'\n'> <'\tgit log HEAD~250 | grep "^ " > output &&\n'> <'\ti=50 &&\n'> <'\twhile test $i -gt 0\n'> <'\tdo\n'> <'\t\techo " commit #$i" &&\n'> <'\t\techo " note #$i" &&\n'> <'\t\ti=$(($i - 1));\n'> <'\tdone > expect &&\n'> <'\ttest_cmp expect output\n'> ) } ) (C {<test_expect_success>} {(SQ <'deleting most notes triggers fanout consolidation'>)} { (SQ <'\n'> <'\t# Expect entire notes tree to have a fanout == 0\n'> <'\tgit ls-tree -r --name-only refs/notes/commits |\n'> <'\twhile read path\n'> <'\tdo\n'> <'\t\tcase "$path" in\n'> <'\t\t????????????????????????????????????????)\n'> <'\t\t\t: true\n'> <'\t\t\t;;\n'> <'\t\t*)\n'> <'\t\t\techo "Invalid path \\"$path\\"" &&\n'> <'\t\t\treturn 1\n'> <'\t\t\t;;\n'> <'\t\tesac\n'> <'\tdone\n'> ) } ) (C {<test_done>}) ] )