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>2021-03-09 16:01:47 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-03-11 10:13:25 +0300
commit06f84a7b4c6fb8b81617efa805e0217d811f6e9a (patch)
tree4020147ea794e39b1a33b8e994cd66aa9a4df4de
parent689fd0d1681938aa34631efd3b96a2a4dc5bffe3 (diff)
git: Add new `WithGlobalOption()` option
We're about to drop injection of global git parameters via the `GlobalOption`s argument of `New()`, `NewWithDir()` and `NewWithoutRepo()`. This commit thus makes available a new `WithGlobalOption()` option to still be able to cover injection of global options.
-rw-r--r--internal/git/command.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/git/command.go b/internal/git/command.go
index a46ef8ab3..61ee5ffbd 100644
--- a/internal/git/command.go
+++ b/internal/git/command.go
@@ -328,3 +328,12 @@ func WithConfig(configPairs ...ConfigPair) CmdOpt {
return nil
}
}
+
+// WithGlobalOption adds the global options to the command. These are universal options which work
+// across all git commands.
+func WithGlobalOption(opts ...GlobalOption) CmdOpt {
+ return func(c *cmdCfg) error {
+ c.globals = append(c.globals, opts...)
+ return nil
+ }
+}