mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
fix multiple files being added to index instead of one
This commit is contained in:
parent
75c2f7af03
commit
2a823f3683
2 changed files with 15 additions and 2 deletions
15
src/app.rs
15
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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crossterm::event::{self, Event};
|
||||
use std::time::Duration;
|
||||
|
||||
///
|
||||
/// as
|
||||
pub enum PollResult {
|
||||
Timeout,
|
||||
Event(Event),
|
||||
|
|
|
|||
Loading…
Reference in a new issue