summaryrefslogtreecommitdiff
path: root/t/t3305-notes-fanout.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-02-13 21:28:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-14 03:36:14 (GMT)
commitb0032d1e06e4a53d908309fce6ad3c5f5a3559a3 (patch)
treeeff896ef36fce43bcc9a59e03a2a5f4c68bbcbe4 /t/t3305-notes-fanout.sh
parent92b3385fca620f47580d695b80b96432c76f0822 (diff)
downloadgit-b0032d1e06e4a53d908309fce6ad3c5f5a3559a3.zip
git-b0032d1e06e4a53d908309fce6ad3c5f5a3559a3.tar.gz
git-b0032d1e06e4a53d908309fce6ad3c5f5a3559a3.tar.bz2
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>
Diffstat (limited to 't/t3305-notes-fanout.sh')
-rwxr-xr-xt/t3305-notes-fanout.sh47
1 files changed, 46 insertions, 1 deletions
diff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh
index 823b0ff..c6d263b 100755
--- a/t/t3305-notes-fanout.sh
+++ b/t/t3305-notes-fanout.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-test_description='Test that adding many notes triggers automatic fanout restructuring'
+test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
. ./test-lib.sh
@@ -47,4 +47,49 @@ test_expect_success 'many notes created with git-notes triggers fanout' '
done
'
+test_expect_success 'deleting most notes with git-notes' '
+ num_notes=250 &&
+ i=0 &&
+ git rev-list HEAD |
+ while read sha1
+ do
+ i=$(($i + 1)) &&
+ if test $i -gt $num_notes
+ then
+ break
+ fi &&
+ test_tick &&
+ git notes remove "$sha1"
+ done
+'
+
+test_expect_success 'most notes deleted correctly with git-notes' '
+ git log HEAD~250 | grep "^ " > output &&
+ i=50 &&
+ while test $i -gt 0
+ do
+ echo " commit #$i" &&
+ echo " note #$i" &&
+ i=$(($i - 1));
+ done > expect &&
+ test_cmp expect output
+'
+
+test_expect_success 'deleting most notes triggers fanout consolidation' '
+ # Expect entire notes tree to have a fanout == 0
+ git ls-tree -r --name-only refs/notes/commits |
+ while read path
+ do
+ case "$path" in
+ ????????????????????????????????????????)
+ : true
+ ;;
+ *)
+ echo "Invalid path \"$path\"" &&
+ return 1
+ ;;
+ esac
+ done
+'
+
test_done