Skip to content

Commit

Permalink
git: Use GIT_DIR env var to find the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkroot committed Oct 30, 2022
1 parent e385cd5 commit 4e23f8e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/fs/feature/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,16 @@ impl GitRepo {
Ok(r) => r,
Err(e) => {
error!("Error discovering Git repositories: {:?}", e);
return Err(path);
match git2::Repository::open_from_env() {
Ok(r) => r,
Err(e) => {
// anything other than NotFound implies GIT_DIR was set and we got actual error
if e.code() != git2::ErrorCode::NotFound {
error!("Error opening Git repo from env using GIT_DIR: {:?}", e);
}
return Err(path);
}
}
}
};

Expand Down

0 comments on commit 4e23f8e

Please sign in to comment.