mirror of
https://github.com/gitui-org/gitui.git
synced 2026-10-12 02:14:16 +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:
@@ -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)
|
||||
}
|
||||
|
||||
+2
-2
@@ -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(()),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user