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>2021-07-29 19:10:13 +0300
committerToon Claes <toon@gitlab.com>2021-07-29 19:10:13 +0300
commitfb9de5f27b55e28a5d4737e0aa639a50ccc3dd75 (patch)
treebbb3b89b6b28dcc9804814edfdfd5e0439a21dbe
parent3fbc0ff9c0c9fa486b753aa23ceac9513a2cde7b (diff)
parent335e3d74b2a67d79f7dcb9bc668ca84178686de6 (diff)
Merge branch 'ps-gitalygit2go-path-resolution' into 'master'
gitaly-git2go: Cleanup backwards compatibility code Closes #3666 See merge request gitlab-org/gitaly!3683
-rw-r--r--Makefile2
-rw-r--r--internal/git2go/executor.go18
2 files changed, 3 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 1d93535cb..1c54dcd86 100644
--- a/Makefile
+++ b/Makefile
@@ -240,7 +240,7 @@ build: ${SOURCE_DIR}/.ruby-bundle libgit2
# We use version suffix for the gitaly-git2go binary to support compatibility contract between
# gitaly and gitaly-git2go during upgrade deployment.
# For more information refer to https://gitlab.com/gitlab-org/gitaly/-/issues/3647#note_599082033
- cp ${BUILD_DIR}/bin/gitaly-git2go "${BUILD_DIR}/bin/gitaly-git2go-${MODULE_VERSION}"
+ mv ${BUILD_DIR}/bin/gitaly-git2go "${BUILD_DIR}/bin/gitaly-git2go-${MODULE_VERSION}"
.PHONY: install
## Install Gitaly binaries. The target directory can be modified by setting PREFIX and DESTDIR.
diff --git a/internal/git2go/executor.go b/internal/git2go/executor.go
index ae7c40616..c2a4a7bef 100644
--- a/internal/git2go/executor.go
+++ b/internal/git2go/executor.go
@@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
- "os"
"os/exec"
"path/filepath"
@@ -20,14 +19,12 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/version"
)
-const rawBinaryName = "gitaly-git2go"
-
var (
// ErrInvalidArgument is returned in case the merge arguments are invalid.
ErrInvalidArgument = errors.New("invalid parameters")
// BinaryName is a binary name with version suffix .
- BinaryName = rawBinaryName + "-" + version.GetModuleVersion()
+ BinaryName = "gitaly-git2go-" + version.GetModuleVersion()
)
// Executor executes gitaly-git2go.
@@ -41,23 +38,12 @@ type Executor struct {
// configuration.
func NewExecutor(cfg config.Cfg, locator storage.Locator) Executor {
return Executor{
- binaryPath: BinaryPath(cfg.BinDir),
+ binaryPath: filepath.Join(cfg.BinDir, BinaryName),
gitBinaryPath: cfg.Git.BinPath,
locator: locator,
}
}
-// BinaryPath returns path to the executable binary.
-func BinaryPath(binaryFolder string) string {
- // At first try to find the versioned binary
- path := filepath.Join(binaryFolder, BinaryName)
- if _, err := os.Stat(path); errors.Is(err, os.ErrNotExist) {
- // if not exist fall back to the old unversioned binary
- path = filepath.Join(binaryFolder, rawBinaryName)
- }
- return path
-}
-
func (b Executor) run(ctx context.Context, repo repository.GitRepo, stdin io.Reader, args ...string) (*bytes.Buffer, error) {
repoPath, err := b.locator.GetRepoPath(repo)
if err != nil {