summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-10-24 10:43:48 +1100
committerJesse Duffield <jessedduffield@gmail.com>2021-10-30 18:26:06 +1100
commitf704707d291387b2c1d7432c7700fb5398432f18 (patch)
tree4d9a54fbfb789af24f49e215f70b7bfe664f1616 /pkg/commands/git.go
parent01d82749b17cd7a048d69c8386044d79548f7893 (diff)
stream output from certain git commands in command log panel
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index a1a925de7..8750ecf51 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -1,6 +1,7 @@
package commands
import (
+ "io"
"io/ioutil"
"os"
"path/filepath"
@@ -40,6 +41,11 @@ type GitCommand struct {
// Push to current determines whether the user has configured to push to the remote branch of the same name as the current or not
PushToCurrent bool
+
+ // this is just a view that we write to when running certain commands.
+ // Coincidentally at the moment it's the same view that OnRunCommand logs to
+ // but that need not always be the case.
+ GetCmdWriter func() io.Writer
}
// NewGitCommand it runs git commands
@@ -77,6 +83,7 @@ func NewGitCommand(
DotGitDir: dotGitDir,
PushToCurrent: pushToCurrent,
GitConfig: gitConfig,
+ GetCmdWriter: func() io.Writer { return ioutil.Discard },
}
gitCommand.PatchManager = patch.NewPatchManager(log, gitCommand.ApplyPatch, gitCommand.ShowFileDiff)