Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion asyncgit/src/sync/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(()),
}
Expand Down
Loading