git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/2] perf: add function to setup a fresh test repo

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 10, 2017, 22:53 UTC
Message-ID
<20170510225316.31680-2-avarab@gmail.com>
In-Reply-To
<20170510225316.31680-1-avarab@gmail.com>

Add a function to setup a fresh test repo via 'git init' to compliment the existing functions to copy over a normal & large repo.

Some performance tests don't need any existing repository data at all to be significant, e.g. tests which stress glob matches against revisions or files, which I'm about to add in a subsequent commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/perf/README      |  1 +
 t/perf/perf-lib.sh | 17 +++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/t/perf/README b/t/perf/README
index 49ea4349be..de2fe15696 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -106,6 +106,7 @@ sources perf-lib.sh:
 
 After that you will want to use some of the following:
 
+	test_perf_fresh_repo    # sets up an empty repository
 	test_perf_default_repo  # sets up a "normal" repository
 	test_perf_large_repo    # sets up a "large" repository
 
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index ab4b8b06ae..f51fc773e8 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -78,6 +78,10 @@ if test -z "$GIT_PERF_LARGE_REPO"; then
 	GIT_PERF_LARGE_REPO=$TEST_DIRECTORY/..
 fi
 
+test_perf_do_repo_symlink_config_ () {
+	test_have_prereq SYMLINKS || git config core.symlinks false
+}
+
 test_perf_create_repo_from () {
 	test "$#" = 2 ||
 	error "bug in the test script: not 2 parameters to test-create-repo"
@@ -102,15 +106,20 @@ test_perf_create_repo_from () {
 	) &&
 	(
 		cd "$repo" &&
-		"$MODERN_GIT" init -q && {
-			test_have_prereq SYMLINKS ||
-			git config core.symlinks false
-		} &&
+		"$MODERN_GIT" init -q &&
+		test_perf_do_repo_symlink_config_ &&
 		mv .git/hooks .git/hooks-disabled 2>/dev/null
 	) || error "failed to copy repository '$source' to '$repo'"
 }
 
 # call at least one of these to establish an appropriately-sized repository
+test_perf_fresh_repo () {
+	repo="${1:-$TRASH_DIRECTORY}"
+	"$MODERN_GIT" init -q "$repo" &&
+	cd "$repo" &&
+	test_perf_do_repo_symlink_config_
+}
+
 test_perf_default_repo () {
 	test_perf_create_repo_from "${1:-$TRASH_DIRECTORY}" "$GIT_PERF_REPO"
 }
-- 
2.11.0
Previous: Ævar Arnfjörð BjarmasonNext: Jonathan Nieder
Message 2 of 9 in “perf: show that wildmatch() regressed for pathological cases in v2.0”
  1. 0/2 perf: show that wildmatch() regressed for pathological cases in v2.0Ævar Arnfjörð Bjarmason, May 10, 2017
  2. 1/2 perf: add function to setup a fresh test repoÆvar Arnfjörð Bjarmason, May 10, 2017
  3. Jonathan NiederMay 10, 2017
  4. Ævar Arnfjörð BjarmasonMay 11, 2017
  5. Junio C HamanoMay 11, 2017
  6. Junio C HamanoMay 11, 2017
  7. Ævar Arnfjörð BjarmasonMay 11, 2017
  8. 2/2 perf: add test showing exponential growth in path globbingÆvar Arnfjörð Bjarmason, May 10, 2017
  9. Jonathan NiederMay 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.