summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-10 16:25:45 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-11 17:07:49 +1000
commit74320f00752926b42f0e4d6f84b3816d7a0134a9 (patch)
treef02514330a4c1494c7233a11312d6a194c9d9122 /pkg/commands
parentbfad972f0c75bb0fb4a60cf6848c1ab205254d87 (diff)
more logging of commands
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git.go7
-rw-r--r--pkg/commands/oscommands/os.go7
2 files changed, 14 insertions, 0 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index db5585172..3a9e434cb 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -84,6 +84,13 @@ func NewGitCommand(log *logrus.Entry, osCommand *oscommands.OSCommand, tr *i18n.
}
func (c *GitCommand) WithSpan(span string) *GitCommand {
+ // sometimes .WithSpan(span) will be called where span actually is empty, in
+ // which case we don't need to log anything so we can just return early here
+ // with the original struct
+ if span == "" {
+ return c
+ }
+
newGitCommand := &GitCommand{}
*newGitCommand = *c
newGitCommand.OSCommand = c.OSCommand.WithSpan(span)
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go
index 2c85cfc5a..55592692f 100644
--- a/pkg/commands/oscommands/os.go
+++ b/pkg/commands/oscommands/os.go
@@ -94,6 +94,13 @@ func NewOSCommand(log *logrus.Entry, config config.AppConfigurer) *OSCommand {
}
func (c *OSCommand) WithSpan(span string) *OSCommand {
+ // sometimes .WithSpan(span) will be called where span actually is empty, in
+ // which case we don't need to log anything so we can just return early here
+ // with the original struct
+ if span == "" {
+ return c
+ }
+
newOSCommand := &OSCommand{}
*newOSCommand = *c
newOSCommand.CmdLogSpan = span