]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3305-notes-fanout.sh
Merge branch 'wb/fsmonitor-bitmap-fix'
[thirdparty/git.git] / t / t3305-notes-fanout.sh
CommitLineData
048cdd46
JH
1#!/bin/sh
2
b0032d1e 3test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
048cdd46
JH
4
5. ./test-lib.sh
6
7test_expect_success 'creating many notes with git-notes' '
8 num_notes=300 &&
9 i=0 &&
10 while test $i -lt $num_notes
11 do
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" &&
aaec9bcf 17 git notes add -m "note #$i" || return 1
048cdd46
JH
18 done
19'
20
21test_expect_success 'many notes created correctly with git-notes' '
22 git log | grep "^ " > output &&
23 i=300 &&
24 while test $i -gt 0
25 do
26 echo " commit #$i" &&
27 echo " note #$i" &&
28 i=$(($i - 1));
29 done > expect &&
30 test_cmp expect output
31'
32
33test_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
37 do
e3e9d02e 38 echo $path | grep "^../[0-9a-f]*$" || {
048cdd46 39 echo "Invalid path \"$path\"" &&
e3e9d02e 40 return 1;
41 }
048cdd46
JH
42 done
43'
44
b0032d1e
JH
45test_expect_success 'deleting most notes with git-notes' '
46 num_notes=250 &&
47 i=0 &&
48 git rev-list HEAD |
6636cf7e 49 while test $i -lt $num_notes && read sha1
b0032d1e
JH
50 do
51 i=$(($i + 1)) &&
b0032d1e 52 test_tick &&
6636cf7e
JK
53 git notes remove "$sha1" ||
54 exit 1
b0032d1e
JH
55 done
56'
57
58test_expect_success 'most notes deleted correctly with git-notes' '
59 git log HEAD~250 | grep "^ " > output &&
60 i=50 &&
61 while test $i -gt 0
62 do
63 echo " commit #$i" &&
64 echo " note #$i" &&
65 i=$(($i - 1));
66 done > expect &&
67 test_cmp expect output
68'
69
70test_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 |
73 while read path
74 do
e3e9d02e 75 echo $path | grep -v "^../.*" || {
b0032d1e 76 echo "Invalid path \"$path\"" &&
e3e9d02e 77 return 1;
78 }
b0032d1e
JH
79 done
80'
81
048cdd46 82test_done