diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-12-08 12:48:22 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2020-12-15 12:04:34 +0300 |
commit | 98b9c4d2a0e0757c9f74c4c7b5adbf7bf6d9c053 (patch) | |
tree | 941cada0f453a7279d70faf4f969349b14623e4a | |
parent | 1296ac533238b39a382a77ced57db6994e28d032 (diff) |
conflicts: Don't set "uploadpack.allowAnySHA1InWant" in environment
In the conflicts service, we're currently setting up the environment
variable "uploadpack.allowAnySHA1InWant=true". This is wrong in multiple
ways: first, setting this variable on the client-side doesn't make any
sense as this is purely a server-side option for git-upload-pack(1). And
second, setting git config options as part of the environment doesn't
have any effect at all.
Fix the issue by removing the setup altogether and inlining the constant
at the only site where its used. This also removes the confusion by
having the constant be called `EnvVar...`, which probably is why it's
been set up as part of the environment in the first place.
-rw-r--r-- | internal/git/uploadpack.go | 6 | ||||
-rw-r--r-- | internal/gitaly/service/conflicts/resolve_conflicts.go | 2 | ||||
-rw-r--r-- | internal/gitalyssh/gitalyssh.go | 6 |
3 files changed, 3 insertions, 11 deletions
diff --git a/internal/git/uploadpack.go b/internal/git/uploadpack.go index 7eab25d3f..531cace89 100644 --- a/internal/git/uploadpack.go +++ b/internal/git/uploadpack.go @@ -1,12 +1,12 @@ package git -import "gitlab.com/gitlab-org/gitaly/internal/gitalyssh" - // UploadPackFilterConfig confines config options that are required to allow // partial-clone filters. func UploadPackFilterConfig() []Option { return []Option{ ValueFlag{"-c", "uploadpack.allowFilter=true"}, - ValueFlag{"-c", gitalyssh.EnvVarUploadPackAllowAnySHA1InWant}, + // Enables the capability to request individual SHA1's from the + // remote repo. + ValueFlag{"-c", "uploadpack.allowAnySHA1InWant=true"}, } } diff --git a/internal/gitaly/service/conflicts/resolve_conflicts.go b/internal/gitaly/service/conflicts/resolve_conflicts.go index 390ae99db..855d65e57 100644 --- a/internal/gitaly/service/conflicts/resolve_conflicts.go +++ b/internal/gitaly/service/conflicts/resolve_conflicts.go @@ -283,8 +283,6 @@ func (s *server) repoWithBranchCommit(ctx context.Context, srcRepo, targetRepo * if err != nil { return err } - // to enable fetching a specific SHA: - env = append(env, gitalyssh.EnvVarUploadPackAllowAnySHA1InWant) srcRepoPath, err := s.locator.GetRepoPath(srcRepo) if err != nil { diff --git a/internal/gitalyssh/gitalyssh.go b/internal/gitalyssh/gitalyssh.go index 253073934..4b57f6168 100644 --- a/internal/gitalyssh/gitalyssh.go +++ b/internal/gitalyssh/gitalyssh.go @@ -26,12 +26,6 @@ const ( GitalyInternalURL = "ssh://gitaly/internal.git" ) -const ( - // EnvVarUploadPackAllowAnySHA1InWant enables the capability to request - // individual SHA1's from the remote repo - EnvVarUploadPackAllowAnySHA1InWant = "uploadpack.allowAnySHA1InWant=true" -) - var ( envInjector = tracing.NewEnvInjector() ) |