mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 00:48:35 +00:00
validate path on startup for gix aswell (#2768)
so far we only try to open using the legacy libgit2 based one
This commit is contained in:
parent
844a208506
commit
2374e00302
2 changed files with 9 additions and 3 deletions
|
|
@ -26,10 +26,16 @@ pub struct Head {
|
|||
|
||||
///
|
||||
pub fn repo_open_error(repo_path: &RepoPath) -> Option<String> {
|
||||
Repository::open_ext(
|
||||
if let Err(e) = Repository::open_ext(
|
||||
repo_path.gitpath(),
|
||||
RepositoryOpenFlags::FROM_ENV,
|
||||
Vec::<&Path>::new(),
|
||||
) {
|
||||
return Some(e.to_string());
|
||||
}
|
||||
|
||||
gix::ThreadSafeRepository::discover_with_environment_overrides(
|
||||
repo_path.gitpath(),
|
||||
)
|
||||
.map_or_else(|e| Some(e.to_string()), |_| None)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,8 +355,8 @@ fn draw(terminal: &mut Terminal, app: &App) -> io::Result<()> {
|
|||
fn ensure_valid_path(repo_path: &RepoPath) -> Result<()> {
|
||||
match asyncgit::sync::repo_open_error(repo_path) {
|
||||
Some(e) => {
|
||||
log::error!("{e}");
|
||||
bail!(e)
|
||||
log::error!("invalid repo path: {e}");
|
||||
bail!("invalid repo path: {e}")
|
||||
}
|
||||
None => Ok(()),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue