diff --git a/src/app.rs b/src/app.rs index 315ba2de..f5edc823 100644 --- a/src/app.rs +++ b/src/app.rs @@ -271,7 +271,20 @@ impl App { let mut index = repo.index().unwrap(); let path = Path::new(self.status.wt_items[i].path.as_str()); - if let Ok(_) = index.add_all(path, IndexAddOption::DISABLE_PATHSPEC_MATCH, None) { + + let cb = &mut |p: &Path, _matched_spec: &[u8]| -> i32 { + if p == path { + 0 + } else { + 1 + } + }; + + if let Ok(_) = index.add_all( + path, + IndexAddOption::DISABLE_PATHSPEC_MATCH | IndexAddOption::CHECK_PATHSPEC, + Some(cb as &mut git2::IndexMatchedPath), + ) { index.write().unwrap(); self.update(); } diff --git a/src/poll.rs b/src/poll.rs index e6c94fe2..cf82fa96 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -1,7 +1,7 @@ use crossterm::event::{self, Event}; use std::time::Duration; -/// +/// as pub enum PollResult { Timeout, Event(Event),