-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git_repository_config does not invalidate a cached git_config based on last date modified #1022
Comments
The |
As mentioned in Campfire: that helps the native client case, but the user could just as easily do similar things with git on the command line. I'd rather it be safe/correct first and performant second. |
I think one way or another, this starts with a Do we do it every time So, as a particularly bad example, More importantly, status is hardly instantaneous; if the config is changed in mid operation by an external program, I don't think it would be "more correct" to reload the config settings. It's actually much more important that it have a consistent view of the config settings across the entire operation. The user of the libgit2 is more likely to know what is an "atomic" operation that needs a consistent view of config / attributes / etc. than the library, which is fundamentally fairly low level, can know. |
Ensuring a consistent view of the configuration across operations basically sounds like locking — perhaps an API to prevent automatic config invalidation during critical sections (for performance and/or correctness)? Your points are all valid, but, ultimately, we need to do something to reconcile external actions upon the repository. Short of watching the filesystem (which is extremely non-portable), I'm not sure what other options there are. |
I don't disagree. Let's get |
Okay, so, we have a refresh API now. @vmg Do you want to use this issue to have a discussion about the merits of automatically refreshing the config under certain circumstances? I think we're both wary about it, but it might be worth flushing out the pros and cons at some point. One option is to write a "quick refresh" that just refreshes the repo-level config and not the other tiers, since that is the level that is most likely to be programmatically altered in a way that would be worth responding to dynamically. It could also be a fairly cheap operation if written well (although the confusion over "changes in file A are dynamically picked up and changes in B are not" might cause more confusion). |
I think that would be completely reasonable. AFAIK, git only modifies the repo config (when not using the "config" command, of course), and I think users of client apps would not be surprised if a global config change required a restart. |
With #2188 merged we now provide a So I'm going to close this as finally resolved. If there's an issue with the new behaviour, let's open an issue about that specifically. |
git_repository_config
andgit_repository_config__weakptr
should re-read the config file from disk if it's been modified since it was last read.Otherwise, git may create branches which, e.g.,
git_branch_tracking
may not know about.The text was updated successfully, but these errors were encountered: