Re: [PATCH 2/2] Cached the git configuration, which is now noticibly faster on windows.
- From
- Steve Frécinaux <nudrema@gmail.com>
- Date
- Nov 10, 2008, 08:38 UTC
- Message-ID
- <4917F2F3.8000408@gmail.com>
- In-Reply-To
- <1226127130.8252.6.camel@therock.nsw.bigpond.net.au>
Arafangion wrote:
Show 12 quoted lines
> On Fri, 2008-11-07 at 21:19 -0800, David Symonds wrote:
> <snip>
>> _gitConfig = None
>> def gitConfig(key):
>> if _gitConfig is None:
>> lines = read_pipe("git config -l", ignore_error=True).readlines():
>> _gitConfig = dict([l.strip().split('=', 1) for l in lines])
>> return _gitConfig.get(key, None)
>
> That certainly is better, if one can assume that git's configuration is
> small. (And relative to the memory usage of the script, it will
> definetly be small).What about using git config --get-regexp to only get the p4-related settings ?
I don't really know the options used by git-p4, but something like this seems like a good candidate to address every trade-off concerns?
git-config --get-regexp '^(p4|user)\.'