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:
authorToon Claes <toon@gitlab.com>2022-07-13 17:59:45 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-18 12:04:56 +0300
commit0794639e74b217d79944d7af64886c3292de3783 (patch)
treea0c64d4f7c435e0c9e46eefac8914430589146f9
parentb3d0d5c58218b5ec9b7dac6fd1accbce42839779 (diff)
gittest: Init with SHA256 object format if wanted
When the gitaly_test_sha256 build tag is set, add extra arguments to git-init(1) so it uses the sha256 object format.
-rw-r--r--internal/git/gittest/repo.go4
-rw-r--r--internal/git/gittest/sha1.go5
-rw-r--r--internal/git/gittest/sha256.go5
3 files changed, 13 insertions, 1 deletions
diff --git a/internal/git/gittest/repo.go b/internal/git/gittest/repo.go
index ff833b5ed..a9ff1e75e 100644
--- a/internal/git/gittest/repo.go
+++ b/internal/git/gittest/repo.go
@@ -258,8 +258,10 @@ func InitRepo(t testing.TB, cfg config.Cfg, storage config.Storage, opts ...Init
repoPath := filepath.Join(storage.Path, relativePath)
args := []string{"init", "--bare"}
+ args = append(args, initRepoExtraArgs...)
+ args = append(args, repoPath)
- Exec(t, cfg, append(args, repoPath)...)
+ Exec(t, cfg, args...)
repo := InitRepoDir(t, storage.Path, relativePath)
repo.StorageName = storage.Name
diff --git a/internal/git/gittest/sha1.go b/internal/git/gittest/sha1.go
new file mode 100644
index 000000000..4630cf524
--- /dev/null
+++ b/internal/git/gittest/sha1.go
@@ -0,0 +1,5 @@
+//go:build !gitaly_test_sha256
+
+package gittest
+
+var initRepoExtraArgs = []string{}
diff --git a/internal/git/gittest/sha256.go b/internal/git/gittest/sha256.go
new file mode 100644
index 000000000..791e429df
--- /dev/null
+++ b/internal/git/gittest/sha256.go
@@ -0,0 +1,5 @@
+//go:build gitaly_test_sha256
+
+package gittest
+
+var initRepoExtraArgs = []string{"--object-format=sha256"}