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:
authorAhmad Sherif <me@ahmadsherif.com>2017-10-05 17:41:17 +0300
committerAhmad Sherif <me@ahmadsherif.com>2017-10-10 17:22:53 +0300
commit322b283e8a38e6ee6f09ac622dd37126cb87b38c (patch)
treecce59bb0a0948f1a5cedadea6a73b64d1bcb3a56 /internal/git
parenta692612feba73638721aea2e02c0e2ae58710496 (diff)
Use relative paths for git object dir attributes
Related to #629
Diffstat (limited to 'internal/git')
-rw-r--r--internal/git/command.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/git/command.go b/internal/git/command.go
index 043a0c5b5..256bed223 100644
--- a/internal/git/command.go
+++ b/internal/git/command.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os/exec"
+ "path"
"strings"
"gitlab.com/gitlab-org/gitaly/internal/command"
@@ -22,12 +23,17 @@ func Command(ctx context.Context, repo *pb.Repository, args ...string) (*command
var env []string
if dir := repo.GetGitObjectDirectory(); dir != "" {
- env = append(env, fmt.Sprintf("GIT_OBJECT_DIRECTORY=%s", dir))
+ env = append(env, fmt.Sprintf("GIT_OBJECT_DIRECTORY=%s", path.Join(repoPath, dir)))
}
if dirs := repo.GetGitAlternateObjectDirectories(); len(dirs) > 0 {
- dirsList := strings.Join(dirs, ":")
- env = append(env, fmt.Sprintf("GIT_ALTERNATE_OBJECT_DIRECTORIES=%s", dirsList))
+ var dirsList []string
+
+ for _, dir := range dirs {
+ dirsList = append(dirsList, path.Join(repoPath, dir))
+ }
+
+ env = append(env, fmt.Sprintf("GIT_ALTERNATE_OBJECT_DIRECTORIES=%s", strings.Join(dirsList, ":")))
}
return command.New(ctx, exec.Command(command.GitPath(), args...), nil, nil, nil, env...)