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

Re: [PATCH] Avoid running lstat(2) on the same cache entry.

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 20, 2008, 02:42 UTC
Message-ID
<alpine.LSU.1.00.0801200231250.5731@racer.site>
In-Reply-To
<alpine.LFD.1.00.0801191709380.2957@woody.linux-foundation.org>
Hi,
On Sat, 19 Jan 2008, Linus Torvalds wrote:
Show 25 quoted lines
> @@ -687,13 +732,20 @@ int run_diff_index(struct rev_info *revs, int cached)
>  	tree = parse_tree_indirect(ent->sha1);
>  	if (!tree)
>  		return error("bad tree object %s", tree_name);
> -	if (read_tree(tree, 1, revs->prune_data))
> -		return error("unable to read tree object %s", tree_name);
> -	ret = diff_cache(revs, active_cache, active_nr, revs->prune_data,
> -			 cached, match_missing);
> +
> +	memset(&opts, 0, sizeof(opts));
> +	opts.head_idx = 1;
> +	opts.index_only = cached;
> +	opts.merge = 1;
> +	opts.fn = oneway_diff;
> +	opts.unpack_data = revs;
> +
> +	init_tree_desc(&t, tree->buffer, tree->size);
> +	unpack_trees(1, &t, &opts);
> +	
>  	diffcore_std(&revs->diffopt);
>  	diff_flush(&revs->diffopt);
> -	return ret;
> +	return 0;
>  }
>

Two problems I see (before I go to bed): match_missing is now ignored, and the return value is set to 0, whereas it was the return value of diff_cache() before.

The first is easily fixed, by replacing the two "0"s in the calls to show_new_file() and show_modified() with "!revs->ignore_merges". Unless I am missing something, of course.

And the second is not _that_ bad, as it seems that diff_cache() has only one return statement, and it returns 0, AFAICS. But it had to be said somewhere.

Ciao, Dscho

Previous: Linus Torvalds
Message 26 of 26 in “Updated in-memory index cleanup”
  1. Linus TorvaldsJan 19, 2008
  2. index: be careful when handling long namesJunio C Hamano, Jan 19, 2008
  3. Avoid running lstat(2) on the same cache entry.Junio C Hamano, Jan 19, 2008
  4. Linus TorvaldsJan 19, 2008
  5. Linus TorvaldsJan 19, 2008
  6. Linus TorvaldsJan 20, 2008
  7. Linus TorvaldsJan 20, 2008
  8. Johannes SchindelinJan 20, 2008
  9. Linus TorvaldsJan 20, 2008
  10. Steffen ProhaskaJan 20, 2008
  11. Johannes SchindelinJan 20, 2008
  12. Junio C HamanoJan 21, 2008
  13. Steffen ProhaskaJan 20, 2008
  14. Johannes SchindelinJan 20, 2008
  15. Also use unpack_trees() in do_diff_cache()Johannes Schindelin, Jan 20, 2008
  16. Linus TorvaldsJan 20, 2008
  17. Linus TorvaldsJan 20, 2008
  18. Johannes SchindelinJan 20, 2008
  19. Linus TorvaldsJan 20, 2008
  20. Johannes SchindelinJan 21, 2008
  21. Try to resurrect the handling for 'diff-index -m'Johannes Schindelin, Jan 20, 2008
  22. Linus TorvaldsJan 20, 2008
  23. Brian DowningJan 20, 2008
  24. Steffen ProhaskaJan 20, 2008
  25. Linus TorvaldsJan 20, 2008
  26. Johannes SchindelinJan 20, 2008

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.