summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xt/perf/p7000-tag-contains.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/perf/p7000-tag-contains.sh b/t/perf/p7000-tag-contains.sh
new file mode 100755
index 0000000000..846f106855
--- /dev/null
+++ b/t/perf/p7000-tag-contains.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test_description='speed of tag --contains lookups'
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+test_expect_success 'find reference points' '
+ recent=$(git rev-parse HEAD~100) &&
+ old=$(git rev-parse HEAD~5000) &&
+ ancient=$(git rev-list | tail -n 1)
+'
+
+test_expect_success 'find most recent tag' '
+ tag=$(git for-each-ref --sort=-taggerdate \
+ --format="%(refname:short)" \
+ refs/tags |
+ head -n 1)
+'
+
+for distance in recent old ancient; do
+ contains=$(eval echo \$$distance)
+ for match in "" "$tag"; do
+ test_perf "contains $distance/${match:-all}" "
+ git tag -l --contains $contains $match
+ "
+ done
+done
+
+test_done