t3305: Verify that removing notes triggers automatic fanout consolidation
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johan Herland committed
Feb 13, 2010 at 22:28 UTC
b0032d1e06e4a53d908309fce6ad3c5f5a3559a3
1 file changed
+46
-1
t/t3305-notes-fanout.sh
+46
-1
@@ -1,6 +1,6 @@
1
#!/bin/sh
2
3
-test_description='Test that adding many notes triggers automatic fanout restructuring'
3
+test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
4
5
. ./test-lib.sh
6
@@ -47,4 +47,49 @@ test_expect_success 'many notes created with git-notes triggers fanout' '
47
done
48
'
49
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
55
+ do
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
64
+'
65
+
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
70
+ do
71
+ echo " commit #$i" &&
72
+ echo " note #$i" &&
73
+ i=$(($i - 1));
74
+ done > expect &&
75
+ test_cmp expect output
76
+'
77
+
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
82
+ do
83
+ case "$path" in
84
+ ????????????????????????????????????????)
85
+ : true
86
+ ;;
87
+ *)
88
+ echo "Invalid path \"$path\"" &&
89
+ return 1
90
+ ;;
91
+ esac
92
+ done
93
+'
94
+
95
test_done