| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='performance of git-describe' |
| 4 | . ./perf-lib.sh |
| 5 | |
| 6 | test_perf_default_repo |
| 7 | |
| 8 | # clear out old tags and give us a known state |
| 9 | test_expect_success 'set up tags' ' |
| 10 | git for-each-ref --format="delete %(refname)" refs/tags >to-delete && |
| 11 | git update-ref --stdin <to-delete && |
| 12 | new=$(git rev-list -1000 HEAD | tail -n 1) && |
| 13 | git tag -m new new $new && |
| 14 | old=$(git rev-list HEAD | tail -n 1) && |
| 15 | git tag -m old old $old |
| 16 | ' |
| 17 | |
| 18 | test_perf 'describe HEAD' ' |
| 19 | git describe HEAD |
| 20 | ' |
| 21 | |
| 22 | test_perf 'describe HEAD with one max candidate' ' |
| 23 | git describe --candidates=1 HEAD |
| 24 | ' |
| 25 | |
| 26 | test_perf 'describe HEAD with one tag' ' |
| 27 | git describe --match=new HEAD |
| 28 | ' |
| 29 | |
| 30 | test_expect_success 'set up many unrelated refs' ' |
| 31 | ref_count=10000 && |
| 32 | git tag -m tip tip HEAD && |
| 33 | test_seq -f "create refs/heads/describe-perf/%05d HEAD" $ref_count | |
| 34 | git update-ref --stdin && |
| 35 | git pack-refs --all |
| 36 | ' |
| 37 | |
| 38 | test_perf 'describe exact tag with many unrelated refs' ' |
| 39 | git describe --exact-match HEAD |
| 40 | ' |
| 41 | |
| 42 | test_done |