| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='Tests diff --color-moved performance' |
| 4 | . ./perf-lib.sh |
| 5 | |
| 6 | test_perf_default_repo |
| 7 | |
| 8 | # The endpoints of the diff can be customized by setting TEST_REV_A |
| 9 | # and TEST_REV_B in the environment when running this test. |
| 10 | |
| 11 | rev="${TEST_REV_A:-v2.28.0}" |
| 12 | if ! rev_a="$(git rev-parse --quiet --verify "$rev")" |
| 13 | then |
| 14 | skip_all="skipping because '$rev' was not found. \ |
| 15 | Use TEST_REV_A and TEST_REV_B to set the revs to use" |
| 16 | test_done |
| 17 | fi |
| 18 | rev="${TEST_REV_B:-v2.29.0}" |
| 19 | if ! rev_b="$(git rev-parse --quiet --verify "$rev")" |
| 20 | then |
| 21 | skip_all="skipping because '$rev' was not found. \ |
| 22 | Use TEST_REV_A and TEST_REV_B to set the revs to use" |
| 23 | test_done |
| 24 | fi |
| 25 | |
| 26 | GIT_PAGER_IN_USE=1 |
| 27 | test_export GIT_PAGER_IN_USE rev_a rev_b |
| 28 | |
| 29 | test_perf 'diff --no-color-moved --no-color-moved-ws large change' ' |
| 30 | git diff --no-color-moved --no-color-moved-ws $rev_a $rev_b |
| 31 | ' |
| 32 | |
| 33 | test_perf 'diff --color-moved --no-color-moved-ws large change' ' |
| 34 | git diff --color-moved=zebra --no-color-moved-ws $rev_a $rev_b |
| 35 | ' |
| 36 | |
| 37 | test_perf 'diff --color-moved-ws=allow-indentation-change large change' ' |
| 38 | git diff --color-moved=zebra --color-moved-ws=allow-indentation-change \ |
| 39 | $rev_a $rev_b |
| 40 | ' |
| 41 | |
| 42 | test_perf 'log --no-color-moved --no-color-moved-ws' ' |
| 43 | git log --no-color-moved --no-color-moved-ws --no-merges --patch \ |
| 44 | -n1000 $rev_b |
| 45 | ' |
| 46 | |
| 47 | test_perf 'log --color-moved --no-color-moved-ws' ' |
| 48 | git log --color-moved=zebra --no-color-moved-ws --no-merges --patch \ |
| 49 | -n1000 $rev_b |
| 50 | ' |
| 51 | |
| 52 | test_perf 'log --color-moved-ws=allow-indentation-change' ' |
| 53 | git log --color-moved=zebra --color-moved-ws=allow-indentation-change \ |
| 54 | --no-merges --patch -n1000 $rev_b |
| 55 | ' |
| 56 | |
| 57 | test_done |