diff options
author | Anton Kaymakchi <anton.kaymakchi@sravni.ru> | 2020-07-21 11:05:29 +0300 |
---|---|---|
committer | Anton Kaymakchi <anton.kaymakchi@sravni.ru> | 2020-07-21 11:05:29 +0300 |
commit | 1ce6c82f35957d74ad3a08a7306dd14393135ef6 (patch) | |
tree | 3224908dd7ffa31031594ac7ef2578544b86d085 /worktree_commit.go | |
parent | 641ee1dd69d3b8616127623e4b9341f4f4196d12 (diff) | |
download | go-git-1ce6c82f35957d74ad3a08a7306dd14393135ef6.tar.gz |
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 { |