libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

Use existing repository configuration instead of building own

Open zvirja opened this issue 6 years ago β€’ 4 comments

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.

zvirja avatar May 17 '19 14:05 zvirja

@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! πŸ‘

zvirja avatar Aug 19 '19 21:08 zvirja

Sorry, no, I don’t work on libgit2sharp really anymore. @bording might be able to help.

ethomson avatar Aug 19 '19 23:08 ethomson

@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!

zvirja avatar Sep 22 '19 21:09 zvirja

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?

jairbubbles avatar May 10 '21 16:05 jairbubbles