diff --git a/CHANGELOG.md b/CHANGELOG.md index f5d89275..f9bb58a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * simplify theme overrides [[@cruessler](https://github.com/cruessler)] ([#1367](https://github.com/extrawurst/gitui/issues/1367)) * support for sign-off of commits [[@domtac](https://github.com/domtac)]([#1757](https://github.com/extrawurst/gitui/issues/1757)) * switched from textwrap to bwrap for text wrapping [[@TheBlackSheep3](https://github.com/TheBlackSheep3/)] ([#1762](https://github.com/extrawurst/gitui/issues/1762)) +* more logging diagnostics when a repo cannot be opened ### Fixes * fix commit dialog char count for multibyte characters ([#1726](https://github.com/extrawurst/gitui/issues/1726)) diff --git a/asyncgit/src/sync/mod.rs b/asyncgit/src/sync/mod.rs index a7bf7d64..a752e07b 100644 --- a/asyncgit/src/sync/mod.rs +++ b/asyncgit/src/sync/mod.rs @@ -94,8 +94,8 @@ pub use tags::{ }; pub use tree::{tree_file_content, tree_files, TreeFile}; pub use utils::{ - get_head, get_head_tuple, is_repo, repo_dir, stage_add_all, - stage_add_file, stage_addremoved, Head, + get_head, get_head_tuple, repo_dir, repo_open_error, + stage_add_all, stage_add_file, stage_addremoved, Head, }; pub use git2::ResetType; diff --git a/asyncgit/src/sync/utils.rs b/asyncgit/src/sync/utils.rs index fff6fecc..a5ec1b3e 100644 --- a/asyncgit/src/sync/utils.rs +++ b/asyncgit/src/sync/utils.rs @@ -25,13 +25,13 @@ pub struct Head { } /// -pub fn is_repo(repo_path: &RepoPath) -> bool { +pub fn repo_open_error(repo_path: &RepoPath) -> Option { Repository::open_ext( repo_path.gitpath(), RepositoryOpenFlags::empty(), Vec::<&Path>::new(), ) - .is_ok() + .map_or_else(|e| Some(e.to_string()), |_| None) } /// diff --git a/src/main.rs b/src/main.rs index 6cab1fa0..3a3a7454 100644 --- a/src/main.rs +++ b/src/main.rs @@ -323,7 +323,11 @@ fn draw( } fn valid_path(repo_path: &RepoPath) -> bool { - asyncgit::sync::is_repo(repo_path) + let error = asyncgit::sync::repo_open_error(repo_path); + if let Some(error) = &error { + eprintln!("repo open error: {error}"); + } + error.is_none() } fn select_event(