From ac2803b9625a9c38c1595f22da8f160969ed9625 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 9 Jun 2014 13:21:59 -0700 Subject: [PATCH] t3302: coding style updates Use "<<-END_OF_HERE_TEXT" to push the contents of here-text to the right in order to show the loop structure better. Use write_script when writing a script to be run. Use "test" (not "[ ... ]") and avoid unnecessary ";" in the middle of a line. Signed-off-by: Junio C Hamano --- t/t3302-notes-index-expensive.sh | 90 +++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/t/t3302-notes-index-expensive.sh b/t/t3302-notes-index-expensive.sh index dc706abe5..aa9dbd770 100755 --- a/t/t3302-notes-index-expensive.sh +++ b/t/t3302-notes-index-expensive.sh @@ -16,43 +16,43 @@ create_repo () { test -d .git || { git init && ( - while [ $nr -lt $number_of_commits ]; do + while test $nr -lt $number_of_commits + do nr=$(($nr+1)) mark=$(($nr+$nr)) notemark=$(($mark+1)) test_tick && - cat < $GIT_COMMITTER_DATE -data <> note_commit + cat <<-INPUT_END && + commit refs/heads/master + mark :$mark + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <>note_commit done && test_tick && - cat < $GIT_COMMITTER_DATE -data < $GIT_COMMITTER_DATE + data < output && + git log | grep "^ " >output && i=$count && - while [ $i -gt 0 ]; do + while test $i -gt 0 + do echo " commit #$i" && echo " note for commit #$i" && - i=$(($i-1)); - done > expect && + i=$(($i-1)) + done >expect && test_cmp expect output } -cat > time_notes << \EOF +write_script time_notes <<\EOF mode=$1 i=1 - while [ $i -lt $2 ]; do + while test $i -lt $2 + do case $1 in no-notes) - GIT_NOTES_REF=non-existing; export GIT_NOTES_REF - ;; + GIT_NOTES_REF=non-existing + export GIT_NOTES_REF + ;; notes) unset GIT_NOTES_REF - ;; + ;; esac - git log >/dev/null + git log i=$(($i+1)) - done + done >/dev/null EOF time_notes () { for mode in no-notes notes do echo $mode - /usr/bin/time "$SHELL_PATH" ../time_notes $mode $1 + /usr/bin/time ../time_notes $mode $1 done } @@ -118,7 +121,8 @@ do_tests () { } do_tests NOT_EXPENSIVE 10 -for count in 100 1000 10000; do +for count in 100 1000 10000 +do do_tests EXPENSIVE $count done -- 2.11.0