summaryrefslogtreecommitdiffstats
path: root/pkg/commands/git_commands/working_tree.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/git_commands/working_tree.go')
-rw-r--r--pkg/commands/git_commands/working_tree.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/pkg/commands/git_commands/working_tree.go b/pkg/commands/git_commands/working_tree.go
index 4e97913fb..f594a639b 100644
--- a/pkg/commands/git_commands/working_tree.go
+++ b/pkg/commands/git_commands/working_tree.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "strings"
"time"
"github.com/go-errors/errors"
@@ -40,8 +41,16 @@ func (self *WorkingTreeCommands) OpenMergeTool() error {
}
// StageFile stages a file
-func (self *WorkingTreeCommands) StageFile(fileName string) error {
- return self.cmd.New("git add -- " + self.cmd.Quote(fileName)).Run()
+func (self *WorkingTreeCommands) StageFile(path string) error {
+ return self.StageFiles([]string{path})
+}
+
+func (self *WorkingTreeCommands) StageFiles(paths []string) error {
+ quotedPaths := make([]string, len(paths))
+ for i, path := range paths {
+ quotedPaths[i] = self.cmd.Quote(path)
+ }
+ return self.cmd.New(fmt.Sprintf("git add -- %s", strings.Join(quotedPaths, " "))).Run()
}
// StageAll stages all files