Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t3302-notes-index-expensive.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t3302-notes-index-expensive.sh` 138 lines ยท 2215 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2007 Johannes E. Schindelin 4 # 5 6 test_description='Test commit notes index (expensive!)' 7 8 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh 12 13 create_repo () { 14 number_of_commits=$1 15 nr=0 16 test -d .git || { 17 git init && 18 ( 19 while test $nr -lt $number_of_commits 20 do 21 nr=$(($nr+1)) 22 mark=$(($nr+$nr)) 23 notemark=$(($mark+1)) 24 test_tick && 25 cat <<-INPUT_END && 26 commit refs/heads/main 27 mark :$mark 28 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE 29 data <>note_commit 46 done && 47 test_tick && 48 cat <<-INPUT_END && 49 commit refs/notes/commits 50 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE 51 data <tmp && 68 grep "^ " tmp >output && 69 i=$count && 70 while test $i -gt 0 71 do 72 echo " commit #$i" && 73 echo " note for commit #$i" && 74 i=$(($i-1)) 75 done >expect && 76 test_cmp expect output 77 } 78 79 write_script time_notes <<\EOF 80 mode=$1 81 i=1 82 while test $i -lt $2 83 do 84 case $1 in 85 no-notes) 86 GIT_NOTES_REF=non-existing 87 export GIT_NOTES_REF 88 ;; 89 notes) 90 unset GIT_NOTES_REF 91 ;; 92 esac 93 git log || exit $? 94 i=$(($i+1)) 95 done >/dev/null 96 EOF 97 98 time_notes () { 99 for mode in no-notes notes 100 do 101 echo $mode 102 /usr/bin/time ../time_notes $mode $1 103 done 104 } 105 106 do_tests () { 107 count=$1 pr=${2-} 108 109 test_expect_success $pr "setup $count" ' 110 mkdir "$count" && 111 ( 112 cd "$count" && 113 create_repo "$count" 114 ) 115 ' 116 117 test_expect_success $pr 'notes work' ' 118 ( 119 cd "$count" && 120 test_notes "$count" 121 ) 122 ' 123 124 test_expect_success "USR_BIN_TIME${pr:+,$pr}" 'notes timing with /usr/bin/time' ' 125 ( 126 cd "$count" && 127 time_notes 100 128 ) 129 ' 130 } 131 132 do_tests 10 133 for count in 100 1000 10000 134 do 135 do_tests "$count" EXPENSIVE 136 done 137 138 test_done