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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-15 15:55:58 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-20 07:32:18 +0300
commitfb1cd5ff1274d10d9bebb2a714e2dcc19375f5aa (patch)
tree9d825fc6a732fc1bddd060d8b0ada5b03f9b613d /internal/gitaly/linguist/linguist.go
parent52f009b5d14ee7dac418498c1b389cb11d43cf80 (diff)
command: Add `WithDir()` option
Callers of the command package that wanted to run the command in a specific directory had to manually set the directory of the `exec.Cmd` they passed into the command package. This is a weird calling convention as ideally, the command package should handle the complete setup for the caller. Add a new option `WithDir()` to handle this usecase inside of the command package and convert callers to use it.
Diffstat (limited to 'internal/gitaly/linguist/linguist.go')
-rw-r--r--internal/gitaly/linguist/linguist.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/gitaly/linguist/linguist.go b/internal/gitaly/linguist/linguist.go
index 2a1a92c60..226972fed 100644
--- a/internal/gitaly/linguist/linguist.go
+++ b/internal/gitaly/linguist/linguist.go
@@ -108,9 +108,9 @@ func (inst *Instance) startGitLinguist(ctx context.Context, repoPath string, com
}
cmd := exec.Command(bundle, "exec", "bin/gitaly-linguist", "--repository="+repoPath, "--commit="+commitID)
- cmd.Dir = inst.cfg.Ruby.Dir
internalCmd, err := command.New(ctx, cmd,
+ command.WithDir(inst.cfg.Ruby.Dir),
command.WithEnvironment(env.AllowedRubyEnvironment(os.Environ())),
command.WithCommandName("git-linguist", "stats"),
)