| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description="Performance tests for git stash -p" |
| 4 | |
| 5 | . ./perf-lib.sh |
| 6 | |
| 7 | test_perf_fresh_repo |
| 8 | |
| 9 | test_expect_success "setup" ' |
| 10 | mkdir files && |
| 11 | test_seq 1 100000 | while read i; do |
| 12 | echo "content $i" >files/$i.txt || return 1 |
| 13 | done && |
| 14 | git add files/ && |
| 15 | git commit -q -m "add tracked files" && |
| 16 | echo modified >files/1.txt |
| 17 | ' |
| 18 | |
| 19 | test_perf "stash -p, no fsmonitor" \ |
| 20 | --setup 'echo modified >files/1.txt' ' |
| 21 | printf "q\n" | git stash -p >/dev/null 2>&1 || true |
| 22 | ' |
| 23 | |
| 24 | if test_have_prereq FSMONITOR_DAEMON |
| 25 | then |
| 26 | test_expect_success "enable builtin fsmonitor" ' |
| 27 | git config core.fsmonitor true && |
| 28 | git fsmonitor--daemon start && |
| 29 | git update-index --fsmonitor && |
| 30 | git status >/dev/null 2>&1 |
| 31 | ' |
| 32 | |
| 33 | test_perf "stash -p, builtin fsmonitor" \ |
| 34 | --setup 'echo modified >files/1.txt && git status >/dev/null 2>&1' ' |
| 35 | printf "q\n" | git stash -p >/dev/null 2>&1 || true |
| 36 | ' |
| 37 | |
| 38 | test_expect_success "stop builtin fsmonitor" ' |
| 39 | git fsmonitor--daemon stop |
| 40 | ' |
| 41 | fi |
| 42 | |
| 43 | test_done |