Re: [PATCH 17/17] memoize common git-path "constant" files
- From
Jeff King <peff@peff.net>
- Date
- Aug 10, 2015, 12:30 UTC
- Message-ID
- <20150810123034.GB32371@sigill.intra.peff.net>
- In-Reply-To
- <55C8937A.3080206@alum.mit.edu>
On Mon, Aug 10, 2015 at 02:05:14PM +0200, Michael Haggerty wrote:
Show 6 quoted lines
> I was wondering whether this memoization could interact badly with > update_common_dir(). For example, if any of the memoized functions were > called before git_common_dir is initialized, then the pre-git_common_dir > value would continue to be used even if git_common_dir is changed > afterwards. But I believe it is taboo to call git_path() before > setup_git_env(), so I think this is not a problem.
Calling git_path() actually ends up in setup_git_env(), because we lazily call it from get_git_dir(). So if somebody tries to tweak common_dir stuff too late, we could in theory cache a bogus value; but the real problem is generating the bogosity in the first place.
-Peff