diff options
author | Toon Claes <toon@gitlab.com> | 2022-07-13 17:59:45 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-18 12:04:56 +0300 |
commit | 0794639e74b217d79944d7af64886c3292de3783 (patch) | |
tree | a0c64d4f7c435e0c9e46eefac8914430589146f9 | |
parent | b3d0d5c58218b5ec9b7dac6fd1accbce42839779 (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.go | 4 | ||||
-rw-r--r-- | internal/git/gittest/sha1.go | 5 | ||||
-rw-r--r-- | internal/git/gittest/sha256.go | 5 |
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"} |