Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <jfargher@gitlab.com>2021-09-28 00:42:39 +0300
committerJames Fargher <jfargher@gitlab.com>2021-10-04 02:35:36 +0300
commit6e414deee3b0281619f9e67f3ffd90efd77a9061 (patch)
treef9a8090718f4b329a72a80a0ee6c6370106b069b
parent4d9e4edccb551f8b4952b91cb20163b4b30582d1 (diff)
Accept patterns for BundleTestRepo test helper
Previously this helper would create bundles for all refs in a repository but to validate incremental backups we will need to be able to generate bundles that only have a selection of refs/objects. To maintain compatibility with existing call sites the default behaviour (no patterns) will continue to bundle all refs.
-rw-r--r--internal/git/gittest/repo.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/git/gittest/repo.go b/internal/git/gittest/repo.go
index 6821a38fb..771549c6c 100644
--- a/internal/git/gittest/repo.go
+++ b/internal/git/gittest/repo.go
@@ -155,10 +155,15 @@ func CloneRepo(t testing.TB, cfg config.Cfg, storage config.Storage, opts ...Clo
return repo, absolutePath
}
-// BundleTestRepo creates a bundle of a local test repo. E.g. `gitlab-test.git`
-func BundleTestRepo(t testing.TB, cfg config.Cfg, sourceRepo, bundlePath string) {
+// BundleTestRepo creates a bundle of a local test repo. E.g.
+// `gitlab-test.git`. `patterns` define the bundle contents as per
+// `git-rev-list-args`. If there are no patterns then `--all` is assumed.
+func BundleTestRepo(t testing.TB, cfg config.Cfg, sourceRepo, bundlePath string, patterns ...string) {
+ if len(patterns) == 0 {
+ patterns = []string{"--all"}
+ }
repoPath := testRepositoryPath(t, sourceRepo)
- Exec(t, cfg, "-C", repoPath, "bundle", "create", bundlePath, "--all")
+ Exec(t, cfg, append([]string{"-C", repoPath, "bundle", "create", bundlePath}, patterns...)...)
}
// testRepositoryPath returns the absolute path of local 'gitlab-org/gitlab-test.git' clone.