summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git.go')
-rw-r--r--pkg/commands/git.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index fd7d9e9b1..05d42b433 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -453,7 +453,15 @@ func (c *GitCommand) usingGpg() bool {
func (c *GitCommand) Commit(message string, flags string) (*exec.Cmd, error) {
command := fmt.Sprintf("git commit %s -m %s", flags, c.OSCommand.Quote(message))
if c.usingGpg() {
- return c.OSCommand.ExecutableFromString(fmt.Sprintf("%s %s %s", c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command)), nil
+ quotedCommand := ""
+ // Windows does not seem to like quotes around the command
+ if c.OSCommand.Platform.os == "windows" {
+ quotedCommand = command
+ } else {
+ quotedCommand = c.OSCommand.Quote(command)
+ }
+
+ return c.OSCommand.ExecutableFromString(fmt.Sprintf("%s %s %s", c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, quotedCommand)), nil
}
return nil, c.OSCommand.RunCommand(command)
@@ -470,7 +478,15 @@ func (c *GitCommand) GetHeadCommitMessage() (string, error) {
func (c *GitCommand) AmendHead() (*exec.Cmd, error) {
command := "git commit --amend --no-edit --allow-empty"
if c.usingGpg() {
- return c.OSCommand.ExecutableFromString(fmt.Sprintf("%s %s %s", c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command)), nil
+ quotedCommand := ""
+ // Windows does not seem to like quotes around the command
+ if c.OSCommand.Platform.os == "windows" {
+ quotedCommand = command
+ } else {
+ quotedCommand = c.OSCommand.Quote(command)
+ }
+
+ return c.OSCommand.ExecutableFromString(fmt.Sprintf("%s %s %s", c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, quotedCommand)), nil
}
return nil, c.OSCommand.RunCommand(command)