support staging

This commit is contained in:
Stephan Dilly 2020-03-17 10:05:28 +01:00
parent 4d75e2d9ac
commit 994e274484
2 changed files with 15 additions and 2 deletions

View File

@ -9,9 +9,10 @@ terminal ui (tui) frontend for git written in rust
* [x] only show diff of selected file
* [x] change detection
* [x] allow scrolling diff
* [x] support staging
* [ ] show added files on working dir changes
* [ ] allow selecting/diff index items
* [ ] support staging/unstaging
* [ ] support unstaging
* [ ] support committing
* [ ] polling in thread
* [ ] support push/pull

View File

@ -160,7 +160,19 @@ impl App {
self.fetch_status();
}
fn index_add(&mut self) {}
fn index_add(&mut self) {
if let Some(i) = self.status_select {
let repo = git_utils::repo();
let mut index = repo.index().unwrap();
let path = Path::new(self.status.wt_items[i].path.as_str());
index.update_all(path, None).unwrap();
index.write().unwrap();
self.update();
}
}
fn scroll(&mut self, inc: bool) {
if inc {