3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='Test commit notes index (expensive!)'
10 test -z "$GIT_NOTES_TIMING_TESTS" && {
11 say Skipping timing tests
22 tree
=$
(git write-tree
) &&
23 while [ $nr -lt $number_of_commits ]; do
25 commit
=$
(echo $nr | git commit-tree
$tree $parent) ||
30 git update-ref refs
/heads
/master
$commit &&
32 export GIT_INDEX_FILE
=.git
/temp
;
33 git rev-list HEAD |
cat -n |
sed "s/^[ ][ ]*/ /g" |
34 while read nr sha1
; do
35 blob
=$
(echo note
$nr | git hash-object
-w --stdin) &&
36 echo $sha1 |
sed "s/^/0644 $blob 0 /"
37 done | git update-index
--index-info &&
38 tree
=$
(git write-tree
) &&
40 commit
=$
(echo notes | git commit-tree
$tree) &&
41 git update-ref refs
/notes
/commits
$commit
43 git config core.notesRef refs
/notes
/commits
49 git config core.notesRef refs
/notes
/commits
&&
50 git log |
grep "^ " > output
&&
52 while [ $i -le $count ]; do
53 echo " $(($count-$i))" &&
57 git
diff expect output
60 cat > time_notes
<< \EOF
63 while [ $i -lt $2 ]; do
66 export GIT_NOTES_REF
=non-existing
78 for mode
in no-notes notes
81 /usr
/bin
/time sh ..
/time_notes
$mode $1
85 for count
in 10 100 1000 10000; do
90 test_expect_success
"setup $count" "create_repo $count"
92 test_expect_success
'notes work' "test_notes $count"
94 test_expect_success
'notes timing' "time_notes 100"