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

Re: [PATCH v2] read_directory: avoid invoking exclude machinery on tracked files

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 17, 2013, 23:18 UTC
Message-ID
<7vvc9qedh2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1360999078-27196-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 8 quoted lines
> If path_handled is returned, contents goes up. And if check_only is
> true, the loop could be broken early. These will not happen when
> treat_one_path (and its wrapper treat_path) returns
> path_ignored. dir_add_name internally does a cache_name_exists() check
> so it makes no difference.
>
> To avoid this behavior change, treat_one_path is instructed to skip
> the optimization when check_only or contents is used.
OK, that makes more understandable why this is safe.
Show 18 quoted lines
> @@ -1242,9 +1246,23 @@ enum path_treatment {
>  static enum path_treatment treat_one_path(struct dir_struct *dir,
>  					  struct strbuf *path,
>  					  const struct path_simplify *simplify,
> -					  int dtype, struct dirent *de)
> +					  int dtype, struct dirent *de,
> +					  int exclude_shortcut_ok)
>  {
> ... 
> @@ -1331,18 +1347,29 @@ static int read_directory_recursive(struct dir_struct *dir,
>  		goto out;
>  
>  	while ((de = readdir(fdir)) != NULL) {
> -		switch (treat_path(dir, de, &path, baselen, simplify)) {
> +		switch (treat_path(dir, de, &path, baselen,
> +				   simplify,
> +				   !check_only && !contents)) {
> ...

Between these two places we may want to say what kind of short-cut we are talking about, but there only is one kind of short-cut at this moment, so let's leave that to other people who want to further optimize things in this codepath by adding other short-cuts.

Thanks; will queue.
Previous: Pete WyckoffNext: Karsten Blees
Message 11 of 12 in “read_directory: avoid invoking exclude machinery on tracked files”
  1. read_directory: avoid invoking exclude machinery on tracked filesNguyễn Thái Ngọc Duy, Feb 15, 2013
  2. Junio C HamanoFeb 15, 2013
  3. Duy NguyenFeb 15, 2013
  4. Junio C HamanoFeb 15, 2013
  5. Duy NguyenFeb 16, 2013
  6. Karsten BleesFeb 18, 2013
  7. read_directory: avoid invoking exclude machinery on tracked filesNguyễn Thái Ngọc Duy, Feb 16, 2013
  8. Pete WyckoffFeb 16, 2013
  9. Duy NguyenFeb 17, 2013
  10. Pete WyckoffFeb 17, 2013
  11. Junio C HamanoFeb 17, 2013
  12. dir.c: Make git-status --ignored even more consistentKarsten Blees, Feb 25, 2013

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.