diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-07-21 10:33:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-21 10:33:37 +0200 |
commit | cded5b685b8a8032605c5704c567c6340dc3953a (patch) | |
tree | 3224908dd7ffa31031594ac7ef2578544b86d085 /worktree_commit.go | |
parent | 641ee1dd69d3b8616127623e4b9341f4f4196d12 (diff) | |
parent | 1ce6c82f35957d74ad3a08a7306dd14393135ef6 (diff) | |
download | go-git-cded5b685b8a8032605c5704c567c6340dc3953a.tar.gz |
Merge pull request #139 from StupidScience/113-git-commit-all-fix
Worktree.Commit: speed up commit with all: true option
Diffstat (limited to 'worktree_commit.go')
-rw-r--r-- | worktree_commit.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/worktree_commit.go b/worktree_commit.go index 167f2e0..a9d0e04 100644 --- a/worktree_commit.go +++ b/worktree_commit.go @@ -58,17 +58,23 @@ func (w *Worktree) autoAddModifiedAndDeleted() error { return err } + idx, err := w.r.Storer.Index() + if err != nil { + return err + } + for path, fs := range s { if fs.Worktree != Modified && fs.Worktree != Deleted { continue } - if _, err := w.Add(path); err != nil { + if _, _, err := w.doAddFile(idx, s, path, nil); err != nil { return err } + } - return nil + return w.r.Storer.SetIndex(idx) } func (w *Worktree) updateHEAD(commit plumbing.Hash) error { |