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

Re: [PATCH] preload-index: avoid lstat for skip-worktree items

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 10, 2017, 22:43 UTC
Message-ID
<xmqqpoipis42.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<a1297b9426e7980f41e9e662fc0f30717c576c3e.1486739428.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 16 quoted lines
> Teach preload-index to avoid lstat() calls for index-entries
> with skip-worktree bit set.  This is a performance optimization.
> ...
> diff --git a/preload-index.c b/preload-index.c
> index c1fe3a3ef9c..70a4c808783 100644
> --- a/preload-index.c
> +++ b/preload-index.c
> @@ -53,6 +53,8 @@ static void *preload_thread(void *_data)
>  			continue;
>  		if (ce_uptodate(ce))
>  			continue;
> +		if (ce_skip_worktree(ce))
> +			continue;
>  		if (!ce_path_match(ce, &p->pathspec, NULL))
>  			continue;
>  		if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))

Because we are only interested in marking the ones that match between the index and the working tree as "up-to-date", and we are not doing the opposite (i.e. toggle "up-to-date" bit off by noticing that things are now different) in this codepath, this change does make sense. The ones marked as "skip", even if there were an unrelated file or directory at the path where the index expects a regular file, can be safely ignored.

Thanks.
Previous: Johannes Schindelin
Message 2 of 2 in “preload-index: avoid lstat for skip-worktree items”
  1. preload-index: avoid lstat for skip-worktree itemsJohannes Schindelin, Feb 10, 2017
  2. Junio C HamanoFeb 10, 2017

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.