aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--worktree_commit.go10
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 {