git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v1] dir.c: don't flag the index as dirty for changes to the untracked cache

From
Jeff King <peff@peff.net>
Date
Feb 8, 2018, 10:33 UTC
Message-ID
<20180208103356.GA30524@sigill.intra.peff.net>
In-Reply-To
<20180205195619.31064-1-benpeart@microsoft.com>
On Mon, Feb 05, 2018 at 02:56:19PM -0500, Ben Peart wrote:
Show 10 quoted lines
> 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,
>  				 dir->untracked->gitignore_invalidated,
>  				 dir->untracked->dir_invalidated,
>  				 dir->untracked->dir_opened);
> -		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) && ...
so that:
  GIT_TEST_UNTRACKED_CACHE=false
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).
-Peff
Previous: Duy NguyenNext: Junio C Hamano
Message 15 of 18 in “dir.c: don't flag the index as dirty for changes to the untracked cache”
  1. dir.c: don't flag the index as dirty for changes to the untracked cacheBen Peart, Feb 5, 2018
  2. Junio C HamanoFeb 5, 2018
  3. Ben PeartFeb 6, 2018
  4. Brandon WilliamsFeb 5, 2018
  5. Ben PeartFeb 6, 2018
  6. Duy NguyenFeb 6, 2018
  7. Duy NguyenFeb 6, 2018
  8. Duy NguyenFeb 7, 2018
  9. Ben PeartFeb 7, 2018
  10. Junio C HamanoFeb 6, 2018
  11. Ben PeartFeb 7, 2018
  12. Duy NguyenFeb 12, 2018
  13. Ben PeartFeb 12, 2018
  14. Duy NguyenFeb 13, 2018
  15. Jeff KingFeb 8, 2018
  16. Junio C HamanoFeb 28, 2018
  17. Jeff KingMar 1, 2018
  18. Ben PeartMar 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.