MSVC: fix poll-related macro redefines
[git/dscho.git] / t / t3305-notes-fanout.sh
blobb1ea64b2130354b1305e752923595128782bc880
1 #!/bin/sh
3 test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
5 . ./test-lib.sh
7 test_expect_success 'creating many notes with git-notes' '
8 num_notes=300 &&
9 i=0 &&
10 while test $i -lt $num_notes
12 i=$(($i + 1)) &&
13 test_tick &&
14 echo "file for commit #$i" > file &&
15 git add file &&
16 git commit -q -m "commit #$i" &&
17 git notes add -m "note #$i" || return 1
18 done
21 test_expect_success 'many notes created correctly with git-notes' '
22 git log | grep "^ " > output &&
23 i=300 &&
24 while test $i -gt 0
26 echo " commit #$i" &&
27 echo " note #$i" &&
28 i=$(($i - 1));
29 done > expect &&
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 |
36 while read path
38 case "$path" in
39 ??/??????????????????????????????????????)
40 : true
43 echo "Invalid path \"$path\"" &&
44 return 1
46 esac
47 done
50 test_expect_success 'deleting most notes with git-notes' '
51 num_notes=250 &&
52 i=0 &&
53 git rev-list HEAD |
54 while read sha1
56 i=$(($i + 1)) &&
57 if test $i -gt $num_notes
58 then
59 break
60 fi &&
61 test_tick &&
62 git notes remove "$sha1"
63 done
66 test_expect_success 'most notes deleted correctly with git-notes' '
67 git log HEAD~250 | grep "^ " > output &&
68 i=50 &&
69 while test $i -gt 0
71 echo " commit #$i" &&
72 echo " note #$i" &&
73 i=$(($i - 1));
74 done > expect &&
75 test_cmp expect output
78 test_expect_success 'deleting most notes triggers fanout consolidation' '
79 # Expect entire notes tree to have a fanout == 0
80 git ls-tree -r --name-only refs/notes/commits |
81 while read path
83 case "$path" in
84 ????????????????????????????????????????)
85 : true
88 echo "Invalid path \"$path\"" &&
89 return 1
91 esac
92 done
95 test_done