From ce923e6fe450d68e1e4f70ad9ef9dc1927357683 Mon Sep 17 00:00:00 2001 From: extrawurst <776816+extrawurst@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:16:01 +0700 Subject: [PATCH] supply libgit2 with flag to respect env variables (#2299) closes #2298 --- CHANGELOG.md | 3 +++ asyncgit/src/sync/repository.rs | 2 +- asyncgit/src/sync/submodules.rs | 2 +- asyncgit/src/sync/utils.rs | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 630cf520d6..7c24f38357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixes +* respect env vars like `GIT_CONFIG_GLOBAL` ([#2298](https://github.com/extrawurst/gitui/issues/2298)) + ## [0.26.3] - 2024-06-02 ### Breaking Changes diff --git a/asyncgit/src/sync/repository.rs b/asyncgit/src/sync/repository.rs index 24620d4cbf..2a0af47dbd 100644 --- a/asyncgit/src/sync/repository.rs +++ b/asyncgit/src/sync/repository.rs @@ -51,7 +51,7 @@ impl From<&str> for RepoPath { pub fn repo(repo_path: &RepoPath) -> Result { let repo = Repository::open_ext( repo_path.gitpath(), - RepositoryOpenFlags::empty(), + RepositoryOpenFlags::FROM_ENV, Vec::<&Path>::new(), )?; diff --git a/asyncgit/src/sync/submodules.rs b/asyncgit/src/sync/submodules.rs index b69dde36d7..f984ac0b19 100644 --- a/asyncgit/src/sync/submodules.rs +++ b/asyncgit/src/sync/submodules.rs @@ -123,7 +123,7 @@ pub fn submodule_parent_info( if let Ok(parent) = Repository::open_ext( parent_path, - RepositoryOpenFlags::empty(), + RepositoryOpenFlags::FROM_ENV, Vec::<&Path>::new(), ) { let parent_wd = work_dir(&parent)?.to_path_buf(); diff --git a/asyncgit/src/sync/utils.rs b/asyncgit/src/sync/utils.rs index a5ec1b3e9b..3e31359799 100644 --- a/asyncgit/src/sync/utils.rs +++ b/asyncgit/src/sync/utils.rs @@ -28,7 +28,7 @@ pub struct Head { pub fn repo_open_error(repo_path: &RepoPath) -> Option { Repository::open_ext( repo_path.gitpath(), - RepositoryOpenFlags::empty(), + RepositoryOpenFlags::FROM_ENV, Vec::<&Path>::new(), ) .map_or_else(|e| Some(e.to_string()), |_| None)