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

Confused about sparse vs untracked-cache

From
David Turner <dturner@twopensource.com>
Date
Jul 30, 2015, 02:32 UTC
Message-ID
<1438223527.18134.53.camel@twopensource.com>
I'm looking at dir.c, and there's a bit I'm confused about:
prep_exclude() says:
		     /*
		      * .. and .gitignore does not exist before
		      * (i.e. null exclude_sha1 and skip_worktree is
		      * not set). Then we can skip loading .gitignore,
		      * which would result in ENOENT anyway.
		      * skip_worktree is taken care in read_directory()
		      */
		     !is_null_sha1(untracked->exclude_sha1))) {
That "skip_worktree is taken care in read_directory()" appears to be
referring to this bit of validate_untracked_cache():
	/*
	 * An optimization in prep_exclude() does not play well with
	 * CE_SKIP_WORKTREE. It's a rare case anyway, if a single
	 * entry has that bit set, disable the whole untracked cache.
	 */
	for (i = 0; i < active_nr; i++)
		if (ce_skip_worktree(active_cache[i]))
			return NULL;
------------
I'm confused about why skip_worktree needs to be unset.  When I comment
out the second snippet, all the tests still pass.  What was the reason
behind that condition?  Is it really necessary?
Next: Duy Nguyen
Message 1 of 5 in “Confused about sparse vs untracked-cache”
  1. David TurnerJul 30, 2015
  2. Duy NguyenJul 30, 2015
  3. David TurnerJul 30, 2015
  4. David TurnerJul 31, 2015
  5. Duy NguyenJul 31, 2015

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.