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

Re: [PATCH 18/19] update-index: test the system before enabling untracked cache

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Oct 28, 2014, 23:25 UTC
Message-ID
<CAPig+cS9C9m-wqMO3up+BRHBN1a0FB-eDO7UUPv7NLx1JCC3PQ@mail.gmail.com>
In-Reply-To
<1414411846-4450-19-git-send-email-pclouds@gmail.com>
On Mon, Oct 27, 2014 at 8:10 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 27 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> diff --git a/builtin/update-index.c b/builtin/update-index.c
> index e57e2d7..471c0b4 100644
> --- a/builtin/update-index.c
> +++ b/builtin/update-index.c
> @@ -48,6 +48,145 @@ static void report(const char *fmt, ...)
>         va_end(vp);
>  }
>
> +static int test_if_untracked_cache_is_supported(void)
> +{
> +       struct stat st;
> +       struct stat_data base;
> +       int fd;
> +
> +       fprintf(stderr, _("Testing "));
> +       xmkdir("dir-mtime-test");
> +       atexit(remove_test_directory);
> +       xstat("dir-mtime-test", &st);
> +       fill_stat_data(&base, &st);
> +       fputc('.', stderr);
> +
> +       avoid_racy();
> +       fd = create_file("dir-mtime-test/newfile");
> +       xstat("dir-mtime-test", &st);
> +       if (!match_stat_data(&base, &st)) {
close(fd);
Show 12 quoted lines
> +               fputc('\n', stderr);
> +               fprintf_ln(stderr,_("directory stat info does not "
> +                                   "change after adding a new file"));
> +               return 0;
> +       }
> +       fill_stat_data(&base, &st);
> +       fputc('.', stderr);
> +
> +       avoid_racy();
> +       xmkdir("dir-mtime-test/new-dir");
> +       xstat("dir-mtime-test", &st);
> +       if (!match_stat_data(&base, &st)) {
close(fd);
Show 58 quoted lines
> +               fputc('\n', stderr);
> +               fprintf_ln(stderr, _("directory stat info does not change "
> +                                    "after adding a new directory"));
> +               return 0;
> +       }
> +       fill_stat_data(&base, &st);
> +       fputc('.', stderr);
> +
> +       avoid_racy();
> +       write_or_die(fd, "data", 4);
> +       close(fd);
> +       xstat("dir-mtime-test", &st);
> +       if (match_stat_data(&base, &st)) {
> +               fputc('\n', stderr);
> +               fprintf_ln(stderr, _("directory stat info changes "
> +                                    "after updating a file"));
> +               return 0;
> +       }
> +       fputc('.', stderr);
> +
> +       avoid_racy();
> +       close(create_file("dir-mtime-test/new-dir/new"));
> +       xstat("dir-mtime-test", &st);
> +       if (match_stat_data(&base, &st)) {
> +               fputc('\n', stderr);
> +               fprintf_ln(stderr, _("directory stat info changes after "
> +                                    "adding a file inside subdirectory"));
> +               return 0;
> +       }
> +       fputc('.', stderr);
> +
> +       avoid_racy();
> +       xunlink("dir-mtime-test/newfile");
> +       xstat("dir-mtime-test", &st);
> +       if (!match_stat_data(&base, &st)) {
> +               fputc('\n', stderr);
> +               fprintf_ln(stderr, _("directory stat info does not "
> +                                    "change after deleting a file"));
> +               return 0;
> +       }
> +       fill_stat_data(&base, &st);
> +       fputc('.', stderr);
> +
> +       avoid_racy();
> +       xunlink("dir-mtime-test/new-dir/new");
> +       xrmdir("dir-mtime-test/new-dir");
> +       xstat("dir-mtime-test", &st);
> +       if (!match_stat_data(&base, &st)) {
> +               fputc('\n', stderr);
> +               fprintf_ln(stderr, _("directory stat info does not "
> +                                    "change after deleting a directory"));
> +               return 0;
> +       }
> +
> +       xrmdir("dir-mtime-test");
> +       fprintf_ln(stderr, _(" OK"));
> +       return 1;
> +}
Previous: Junio C HamanoNext: Nguyễn Thái Ngọc Duy
Message 29 of 65 in “Untracked cache to speed up "git status"”
  1. 00/19 Untracked cache to speed up "git status"Nguyễn Thái Ngọc Duy, Oct 27, 2014
  2. 01/19 dir.c: optionally compute sha-1 of a .gitignore fileNguyễn Thái Ngọc Duy, Oct 27, 2014
  3. Junio C HamanoOct 27, 2014
  4. Duy NguyenOct 28, 2014
  5. Torsten BögershausenOct 28, 2014
  6. Duy NguyenNov 2, 2014
  7. 02/19 untracked cache: record .gitignore information and dir hierarchyNguyễn Thái Ngọc Duy, Oct 27, 2014
  8. Torsten BögershausenOct 28, 2014
  9. 03/19 untracked cache: initial untracked cache validationNguyễn Thái Ngọc Duy, Oct 27, 2014
  10. 04/19 untracked cache: invalidate dirs recursively if .gitignore changesNguyễn Thái Ngọc Duy, Oct 27, 2014
  11. 05/19 untracked cache: make a wrapper around {open,read,close}dir()Nguyễn Thái Ngọc Duy, Oct 27, 2014
  12. 06/19 untracked cache: record/validate dir mtime and reuse cached outputNguyễn Thái Ngọc Duy, Oct 27, 2014
  13. Eric SunshineOct 30, 2014
  14. 07/19 untracked cache: mark what dirs should be recursed/savedNguyễn Thái Ngọc Duy, Oct 27, 2014
  15. 08/19 untracked cache: don't open non-existent .gitignoreNguyễn Thái Ngọc Duy, Oct 27, 2014
  16. 09/19 untracked cache: save to an index extensionNguyễn Thái Ngọc Duy, Oct 27, 2014
  17. 10/19 untracked cache: load from UNTR index extensionNguyễn Thái Ngọc Duy, Oct 27, 2014
  18. 11/19 untracked cache: invalidate at index addition or removalNguyễn Thái Ngọc Duy, Oct 27, 2014
  19. 12/19 read-cache.c: split racy stat test to a separate functionNguyễn Thái Ngọc Duy, Oct 27, 2014
  20. 13/19 untracked cache: avoid racy timestampsNguyễn Thái Ngọc Duy, Oct 27, 2014
  21. 14/19 untracked cache: print stats with $GIT_TRACE_UNTRACKED_STATSNguyễn Thái Ngọc Duy, Oct 27, 2014
  22. 15/19 untracked cache: mark index dirty if untracked cache is updatedNguyễn Thái Ngọc Duy, Oct 27, 2014
  23. 16/19 status: enable untracked cacheNguyễn Thái Ngọc Duy, Oct 27, 2014
  24. 17/19 update-index: manually enable or disable untracked cacheNguyễn Thái Ngọc Duy, Oct 27, 2014
  25. 18/19 update-index: test the system before enabling untracked cacheNguyễn Thái Ngọc Duy, Oct 27, 2014
  26. Torsten BögershausenOct 28, 2014
  27. Duy NguyenNov 3, 2014
  28. Junio C HamanoNov 3, 2014
  29. Eric SunshineOct 28, 2014
  30. 19/19 t7063: tests for untracked cacheNguyễn Thái Ngọc Duy, Oct 27, 2014
  31. 00/22 untracked cache updatesNguyễn Thái Ngọc Duy, Nov 8, 2014
  32. 01/22 dir.c: optionally compute sha-1 of a .gitignore fileNguyễn Thái Ngọc Duy, Nov 8, 2014
  33. David TurnerNov 17, 2014
  34. 02/22 untracked cache: record .gitignore information and dir hierarchyNguyễn Thái Ngọc Duy, Nov 8, 2014
  35. brian m. carlsonNov 8, 2014
  36. David TurnerNov 17, 2014
  37. 03/22 untracked cache: initial untracked cache validationNguyễn Thái Ngọc Duy, Nov 8, 2014
  38. 04/22 untracked cache: invalidate dirs recursively if .gitignore changesNguyễn Thái Ngọc Duy, Nov 8, 2014
  39. 05/22 untracked cache: make a wrapper around {open,read,close}dir()Nguyễn Thái Ngọc Duy, Nov 8, 2014
  40. 06/22 untracked cache: record/validate dir mtime and reuse cached outputNguyễn Thái Ngọc Duy, Nov 8, 2014
  41. 07/22 untracked cache: mark what dirs should be recursed/savedNguyễn Thái Ngọc Duy, Nov 8, 2014
  42. 08/22 untracked cache: don't open non-existent .gitignoreNguyễn Thái Ngọc Duy, Nov 8, 2014
  43. 09/22 untracked cache: save to an index extensionNguyễn Thái Ngọc Duy, Nov 8, 2014
  44. 10/22 untracked cache: load from UNTR index extensionNguyễn Thái Ngọc Duy, Nov 8, 2014
  45. 11/22 untracked cache: invalidate at index addition or removalNguyễn Thái Ngọc Duy, Nov 8, 2014
  46. 12/22 read-cache.c: split racy stat test to a separate functionNguyễn Thái Ngọc Duy, Nov 8, 2014
  47. 13/22 untracked cache: avoid racy timestampsNguyễn Thái Ngọc Duy, Nov 8, 2014
  48. 14/22 untracked cache: print stats with $GIT_TRACE_UNTRACKED_STATSNguyễn Thái Ngọc Duy, Nov 8, 2014
  49. 15/22 untracked cache: mark index dirty if untracked cache is updatedNguyễn Thái Ngọc Duy, Nov 8, 2014
  50. 16/22 untracked-cache: temporarily disable with $GIT_DISABLE_UNTRACKED_CACHENguyễn Thái Ngọc Duy, Nov 8, 2014
  51. 17/22 status: enable untracked cacheNguyễn Thái Ngọc Duy, Nov 8, 2014
  52. 18/22 update-index: manually enable or disable untracked cacheNguyễn Thái Ngọc Duy, Nov 8, 2014
  53. 19/22 update-index: test the system before enabling untracked cacheNguyễn Thái Ngọc Duy, Nov 8, 2014
  54. 20/22 t7063: tests for untracked cacheNguyễn Thái Ngọc Duy, Nov 8, 2014
  55. 21/22 mingw32: add uname()Nguyễn Thái Ngọc Duy, Nov 8, 2014
  56. Eric SunshineNov 9, 2014
  57. Duy NguyenNov 9, 2014
  58. Torsten BögershausenNov 9, 2014
  59. Junio C HamanoNov 9, 2014
  60. 22/22 untracked cache: guard and disable on system changesNguyễn Thái Ngọc Duy, Nov 8, 2014
  61. Eric SunshineNov 9, 2014
  62. Duy NguyenNov 9, 2014
  63. Torsten BögershausenNov 9, 2014
  64. Duy NguyenNov 9, 2014
  65. Torsten BögershausenNov 10, 2014

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.