fix crash when trying to add files in new folderq

This commit is contained in:
Stephan Dilly 2020-03-18 10:55:23 +01:00
parent 472bec5db3
commit ca6650b9de
3 changed files with 12 additions and 6 deletions

View file

@ -20,7 +20,6 @@ Over the last 2 years my go to GUI tool for this was [fork](https://git-fork.com
* [x] show added files on working dir changes
* [x] support committing
* [x] popup centered
* [ ] crash: adding a pic to index crashes
* [ ] crash: renamed files cannot be added to index
* [ ] allow selecting/diff index items
* [ ] support unstaging

View file

@ -270,10 +270,14 @@ impl App {
let mut index = repo.index().unwrap();
let path = Path::new(self.status.wt_items[i].path.as_str());
index.add_path(path).unwrap();
index.write().unwrap();
self.update();
if path.is_file() {
if let Ok(_) = index.add_path(path) {
index.write().unwrap();
self.update();
}
} else {
unimplemented!("can only add files");
}
}
}

View file

@ -57,7 +57,10 @@ impl StatusLists {
let statuses = repo
.statuses(Some(
StatusOptions::default().show(show).include_untracked(true),
StatusOptions::default()
.show(show)
.include_untracked(true)
.recurse_untracked_dirs(true),
))
.unwrap();