Re: [PATCH v1] dir.c: don't flag the index as dirty for changes to the untracked cache
- Date: Thu, 8 Feb 2018 05:33:56 -0500
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: [PATCH v1] dir.c: don't flag the index as dirty for changes to the untracked cache
On Mon, Feb 05, 2018 at 02:56:19PM -0500, Ben Peart wrote:
> diff --git a/dir.c b/dir.c
> index 7c4b45e30e..da93374f0c 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -2297,7 +2297,8 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
> - if (dir->untracked == istate->untracked &&
> + if (getenv("GIT_TEST_UNTRACKED_CACHE") &&
A minor nit, but please use something like:
if (git_env_bool("GIT_TEST_UNTRACKED_CACHE", 0) && ...
does what one might expect, and not the opposite.
Two other thoughts:
- it may be worth memo-izing it with a static variable to avoid
repeatedly calling the possibly-slow getenv()
- I agree with the sentiment elsewhere that something like
GIT_FORCE_UNTRACKED_CACHE is probably a better name
(The idea itself seems sound to me, but it's not really my area).