From dd564a9d29871f791d7856edf3b38142b5b2c5e3 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 15 Oct 2020 14:54:25 +0200 Subject: pkg/vcs: add repo OptPrecious and OptDontSandbox options The pkg/vcs code assumed that we fully manage the repo within an autonomous program. In particular it tried to repair any errors by dropping and re-creating the repo. This does not work well for command-line tools that work with a user-provided repo. Add OptPrecious for such uses. Update #2171 --- pkg/vcs/git_test_util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg/vcs/git_test_util.go') diff --git a/pkg/vcs/git_test_util.go b/pkg/vcs/git_test_util.go index 5ef6c50c3..a1dbf0dd9 100644 --- a/pkg/vcs/git_test_util.go +++ b/pkg/vcs/git_test_util.go @@ -49,7 +49,7 @@ func MakeTestRepo(t *testing.T, dir string) *TestRepo { Dir: dir, name: filepath.Base(dir), Commits: make(map[string]map[string]*Commit), - repo: newGit(dir, ignoreCC), + repo: newGit(dir, ignoreCC, []RepoOpt{OptPrecious, OptDontSandbox}), } repo.Git("init") repo.Git("config", "--add", "user.email", userEmail) @@ -123,7 +123,7 @@ func CloneTestRepo(t *testing.T, baseDir, name string, originRepo *TestRepo) *Te Dir: dir, name: filepath.Base(dir), Commits: make(map[string]map[string]*Commit), - repo: newGit(dir, ignoreCC), + repo: newGit(dir, ignoreCC, []RepoOpt{OptPrecious, OptDontSandbox}), } repo.Git("clone", originRepo.Dir, repo.Dir) return repo -- cgit mrf-deployment