-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
FormCommit: Read committer info using git #10843
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
This increases the startup time for the first start of FormCommit with about 150 ms.
Annoying...
The cache should probably be cleared when exiting settings form.
GitCommands/Git/GitModule.cs
Outdated
@@ -2313,8 +2313,14 @@ public string GetSetting(string setting) | |||
return LocalConfigFile.GetValue(setting); | |||
} | |||
|
|||
public string GetEffectiveSetting(string setting) | |||
public string GetEffectiveSetting(string setting, bool useGit = false, bool useCache = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a separate function instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please. Let's call it GetEffectiveGitSetting()
. Cache by default until we have a real use case that requires no caching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests simulating the reported scenario would be great to have.
Should the setting be reloaded when a repo is switched? |
Yes. Config in other repo can be different. |
I am going to do it async.
good point
I thought we do so already - and was wrong again as in a discussion longer ago. I am adding a non-static cache.
I am going to adapt the existing tests as far as necessary. |
All current usages of the BTW: Is a cache entry really such expensive that we limit the MRU cache to 50 entries? |
b089a68
to
97f7a26
Compare
97f7a26
to
0b0d26a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not run, but it looks fine.
GitUI/CommandsDialogs/FormCommit.cs
Outdated
? committer | ||
: $"{committer} {_commitAuthorInfo.Text} {toolAuthor.Text}"; | ||
await this.SwitchToMainThreadAsync(); | ||
commitAuthorStatus.Text = string.IsNullOrEmpty(toolAuthor.Text?.Trim()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
commitAuthorStatus.Text = string.IsNullOrEmpty(toolAuthor.Text?.Trim()) | |
commitAuthorStatus.Text = string.IsNullOrWhitespace(toolAuthor.Text)) |
Thank you for directly proposing a name, Igor.
I agree. Caching should be the default for settings. So, since this PR does not depend on caching ( |
b412669
to
f9631e2
Compare
Sorry AppVeyor, I have found where to place the missing wait. |
Yes, it works wonderfully, thank you! |
Fixes #5492 (comment)
Proposed changes
use
RunAsync
anddo not cache the git output in order to update on FormActivate (existing testcase)
Screenshots
unchanged
Test methodology
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.