2 Commits

Author SHA1 Message Date
74a7772a29 Fix wrong report when ignored files exist 2021-11-20 18:04:02 +01:00
5df6dcb053 Shorten report for unchanged repo 2021-11-20 18:03:40 +01:00
2 changed files with 5 additions and 2 deletions

View File

@@ -387,7 +387,7 @@ fn add_repo_status(table: &mut Table, repo_name: &str, repo_handle: &git2::Repos
} }
out.into_iter().collect::<String>().trim().to_string() out.into_iter().collect::<String>().trim().to_string()
}, },
None => String::from("No changes"), None => String::from("\u{2714}"),
}, },
&repo_status.branches.iter().map(|(branch_name, remote_branch)| { &repo_status.branches.iter().map(|(branch_name, remote_branch)| {
format!("branch: {}{}\n", format!("branch: {}{}\n",

View File

@@ -237,7 +237,7 @@ pub fn get_repo_status(repo: &git2::Repository) -> RepoStatus {
false => Some(repo.head().unwrap().shorthand().unwrap().to_string()), false => Some(repo.head().unwrap().shorthand().unwrap().to_string()),
}; };
let statuses = repo.statuses(None).unwrap(); let statuses = repo.statuses(Some(git2::StatusOptions::new().include_ignored(false))).unwrap();
let changes = match statuses.is_empty() { let changes = match statuses.is_empty() {
true => None, true => None,
@@ -264,6 +264,9 @@ pub fn get_repo_status(repo: &git2::Repository) -> RepoStatus {
files_deleted += 1; files_deleted += 1;
} }
} }
if (files_new, files_modified, files_deleted) == (0, 0, 0) {
panic!("is_empty() returned true, but no file changes were detected. This is a bug!");
}
Some(RepoChanges { Some(RepoChanges {
files_new, files_new,
files_modified, files_modified,