show renamed files correctly in index

This commit is contained in:
Stephan Dilly 2020-03-18 12:15:50 +01:00
parent 2a823f3683
commit 79308db48d

View File

@ -67,12 +67,18 @@ impl StatusLists {
for e in statuses.iter() { for e in statuses.iter() {
let status: Status = e.status(); let status: Status = e.status();
if status.is_ignored() { // if status.is_ignored() {
continue; // continue;
} // }
let path = if let Some(diff) = e.head_to_index() {
String::from(diff.new_file().path().unwrap().to_str().unwrap())
} else {
e.path().unwrap().to_string()
};
res.push(StatusItem { res.push(StatusItem {
path: e.path().unwrap().to_string(), path,
status: Some(StatusItemType::from(status)), status: Some(StatusItemType::from(status)),
}); });
} }