Properly report status on worktree repos
This commit is contained in:
@@ -790,11 +790,7 @@ impl Repo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let changes = match is_worktree {
|
let changes = match is_worktree {
|
||||||
true => {
|
true => None,
|
||||||
return Err(String::from(
|
|
||||||
"Cannot get changes as this is a bare worktree repository",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
false => {
|
false => {
|
||||||
let statuses = self
|
let statuses = self
|
||||||
.0
|
.0
|
||||||
|
|||||||
31
src/table.rs
31
src/table.rs
@@ -30,21 +30,24 @@ fn add_repo_status(
|
|||||||
true => "\u{2714}",
|
true => "\u{2714}",
|
||||||
false => "",
|
false => "",
|
||||||
},
|
},
|
||||||
&match repo_status.changes {
|
&match is_worktree {
|
||||||
Some(changes) => {
|
true => String::from(""),
|
||||||
let mut out = Vec::new();
|
false => match repo_status.changes {
|
||||||
if changes.files_new > 0 {
|
Some(changes) => {
|
||||||
out.push(format!("New: {}\n", changes.files_new))
|
let mut out = Vec::new();
|
||||||
|
if changes.files_new > 0 {
|
||||||
|
out.push(format!("New: {}\n", changes.files_new))
|
||||||
|
}
|
||||||
|
if changes.files_modified > 0 {
|
||||||
|
out.push(format!("Modified: {}\n", changes.files_modified))
|
||||||
|
}
|
||||||
|
if changes.files_deleted > 0 {
|
||||||
|
out.push(format!("Deleted: {}\n", changes.files_deleted))
|
||||||
|
}
|
||||||
|
out.into_iter().collect::<String>().trim().to_string()
|
||||||
}
|
}
|
||||||
if changes.files_modified > 0 {
|
None => String::from("\u{2714}"),
|
||||||
out.push(format!("Modified: {}\n", changes.files_modified))
|
},
|
||||||
}
|
|
||||||
if changes.files_deleted > 0 {
|
|
||||||
out.push(format!("Deleted: {}\n", changes.files_deleted))
|
|
||||||
}
|
|
||||||
out.into_iter().collect::<String>().trim().to_string()
|
|
||||||
}
|
|
||||||
None => String::from("\u{2714}"),
|
|
||||||
},
|
},
|
||||||
repo_status
|
repo_status
|
||||||
.branches
|
.branches
|
||||||
|
|||||||
Reference in New Issue
Block a user