mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 11:02:41 +03:00
Drop the git config cache when getting focus
This allows changing git config values while lazygit is running (e.g. in a different terminal tab, or even in lazygit's ":" shell prompt), and have them take effect immediately, while still getting some benefit from caching them while lazygit is in the foreground.
This commit is contained in:
@@ -15,6 +15,8 @@ type IGitConfig interface {
|
||||
GetGeneral(string) string
|
||||
// this is for when you want to pass 'mykey' and check if the result is truthy
|
||||
GetBool(string) bool
|
||||
|
||||
DropCache()
|
||||
}
|
||||
|
||||
type CachedGitConfig struct {
|
||||
@@ -93,3 +95,10 @@ func isTruthy(value string) bool {
|
||||
lcValue := strings.ToLower(value)
|
||||
return lcValue == "true" || lcValue == "1" || lcValue == "yes" || lcValue == "on"
|
||||
}
|
||||
|
||||
func (self *CachedGitConfig) DropCache() {
|
||||
self.mutex.Lock()
|
||||
defer self.mutex.Unlock()
|
||||
|
||||
self.cache = make(map[string]string)
|
||||
}
|
||||
|
Reference in New Issue
Block a user