diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-29 13:24:45 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-29 13:35:11 +0300 |
commit | da5041d983e51e90f5202afd68511a9bb242da6b (patch) | |
tree | 3a3430b2fb2a1bcfbfb6105a2a5b0919147accf3 | |
parent | ca8820bb03f012e8abfe7f5da0dfcd9eeb8003b9 (diff) |
gittest: Remove "origin" remote in `CloneRepo()`
With the `gittest.CloneRepo()` helper callers can easily create a
repository from a specific source repository. One slight issue with this
helper though is that the resulting repository still has the `origin`
remote after the RPC finishes, which makes it inconsistent with repos
we'd typically see in production.
Let's remove the remote after having cloned the repository. This is a
preparatory commit for an upcoming change where we start to measure how
many config keys we're pruning in `housekeeping.CleanStaleData()`, as
otherwise we'd have to amend all of our testcases in that package to
also report the cleaned-up default repository.
-rw-r--r-- | internal/git/gittest/repo.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/git/gittest/repo.go b/internal/git/gittest/repo.go index 45369493d..1d606fa7f 100644 --- a/internal/git/gittest/repo.go +++ b/internal/git/gittest/repo.go @@ -308,6 +308,7 @@ func CloneRepo(t testing.TB, cfg config.Cfg, storage config.Storage, opts ...Clo absolutePath := filepath.Join(storage.Path, relativePath) Exec(t, cfg, append(args, testRepositoryPath(t, sourceRepo), absolutePath)...) + Exec(t, cfg, "-C", absolutePath, "remote", "remove", "origin") t.Cleanup(func() { require.NoError(t, os.RemoveAll(absolutePath)) }) |