diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-08-26 13:24:37 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-08-30 12:10:58 +0300 |
commit | 43712287b0b811a55840b90ac4889103428526f4 (patch) | |
tree | cfd22f0a38cdbbbae2ee7feba631fab663d7708d /cmd | |
parent | 6c68e8cf4ac518847183b6e44419d5bc8647951e (diff) |
gitaly-git2go: Fix merge response always going to stdout
Originally, gitaly-git2go commands would always write to their responses
to stdout themselves. With the introduction of gob for serialization and
deserialization of inputs and outputs, this has changed to pass in a
reader and writer to all commands. The merge subcommand is still
directly writing to stdout though.
Fix this issue by writing to the passed-in writer instead. This is only
a theoretical issue: there are no callers which would ask gitaly-git2go
subcommands to write anywhere else.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gitaly-git2go/merge.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cmd/gitaly-git2go/merge.go b/cmd/gitaly-git2go/merge.go index 43922272f..8fc6df65c 100644 --- a/cmd/gitaly-git2go/merge.go +++ b/cmd/gitaly-git2go/merge.go @@ -8,7 +8,6 @@ import ( "flag" "fmt" "io" - "os" "time" git "github.com/libgit2/git2go/v31" @@ -27,7 +26,7 @@ func (cmd *mergeSubcommand) Flags() *flag.FlagSet { return flags } -func (cmd *mergeSubcommand) Run(context.Context, io.Reader, io.Writer) error { +func (cmd *mergeSubcommand) Run(_ context.Context, _ io.Reader, w io.Writer) error { request, err := git2go.MergeCommandFromSerialized(cmd.request) if err != nil { return err @@ -46,7 +45,7 @@ func (cmd *mergeSubcommand) Run(context.Context, io.Reader, io.Writer) error { CommitID: commitID, } - if err := response.SerializeTo(os.Stdout); err != nil { + if err := response.SerializeTo(w); err != nil { return err } |