3 test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
7 test_expect_success 'creating many notes with git-notes' '
10 while test $i -lt $num_notes
14 echo "file for commit #$i" > file &&
16 git commit -q -m "commit #$i" &&
17 git notes add -m "note #$i" || return 1
21 test_expect_success 'many notes created correctly with git-notes' '
22 git log | grep "^ " > output &&
30 test_cmp expect output
33 test_expect_success 'many notes created with git-notes triggers fanout' '
34 # Expect entire notes tree to have a fanout == 1
35 git ls-tree -r --name-only refs/notes/commits |
38 echo $path | grep "^../[0-9a-f]*$" || {
39 echo "Invalid path \"$path\"" &&
45 test_expect_success 'deleting most notes with git-notes' '
49 while test $i -lt $num_notes && read sha1
53 git notes remove "$sha1" ||
58 test_expect_success 'most notes deleted correctly with git-notes' '
59 git log HEAD~250 | grep "^ " > output &&
67 test_cmp expect output
70 test_expect_success 'deleting most notes triggers fanout consolidation' '
71 # Expect entire notes tree to have a fanout == 0
72 git ls-tree -r --name-only refs/notes/commits |
75 echo $path | grep -v "^../.*" || {
76 echo "Invalid path \"$path\"" &&