Use existing repository configuration instead of building own
Fixes #1678
During deep investigation of the issue #1678 I found that it occurs when we instantiate the Configuration object. It happens because we re-build libgit repository configuration and resolve wrong path for local repo config file. We assume that git config file is located under the current repo's git directory, while for worktrees it's not true (commondir should be used instead).
It might be possible to fix the issue using git_repository_commondir when building path to local config, however I decided to go further.
I believe we shouldn't rebuild libgit repository configuration, but use the existing one if possible. This way we support native behavior and potential upcoming new features transparently. People will not see difference when they use our library or native library - it will behave the same. And moreover, we are eliminating a chance of getting the original issue, when observable behavior of various APIs changes when we activate Configuration object under the hood.
I'm happy that we don't introduce breaking changes for the public surface, as my changes affect internal API only.
I've tested the changes and it works like a charm for me. Auto-tests are also passing. Please let me know if you see any issues.
Thanks! π
P.S. It seems that build fails due to some common issues, as other PRs suffer from that as well.
@ethomson Hey! Do you know whether you have time to review this PR in the nearby future? Am not trying to hurry you up, but just want to get rid of the annoying issue with our build scripts (yeah, we face it when using Cake π).
Thanks for the awesome job you are doing! π
Sorry, no, I donβt work on libgit2sharp really anymore. @bording might be able to help.
@bording Hey! Don't want to annoy you, but could you please some time to take a look? I need this fix in my day-to-day activities and periodically face the issue over and over again π
Thanks!
Hi all,
I had the same problem on my side. I cherry picked @zvirja changes and now it works like a charm, thanks for this!
@bording Do you feel like it could be merged? Do you need help to review the changes?