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

Re: [PATCH v2 5/5] Accelerate clear_skip_worktree_from_present_files() by caching

From
Elijah Newren <newren@gmail.com>
Date
Feb 17, 2022, 04:40 UTC
Message-ID
<CABPp-BHbpO7CUXApVcEuv-Q-+_+oCTh_gmRO9UOwQPYPsbAH+A@mail.gmail.com>
In-Reply-To
<CABPp-BEog_CBEjx3FBGdUAhjwrPPDuP54HWQssAWnGeUnr0cBg@mail.gmail.com>
On Wed, Feb 16, 2022 at 8:30 AM Elijah Newren <newren@gmail.com> wrote:
Show 6 quoted lines
>
> On Wed, Feb 16, 2022 at 1:37 AM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
> >
> > On Fri, Jan 14 2022, Elijah Newren via GitGitGadget wrote:
> >
...
Show 19 quoted lines
> > > +
> > > +     /* Free previous dirname, and cache path's dirname */
> > > +     *dirname = path;
> > > +     *dir_len = newdir - path + 1;
> > > +
> > > +     tmp = xstrndup(path, *dir_len);
> > > +     *dir_found = !lstat(tmp, &st);
> >
> > In most other places we're a bit more careful about lstat() error handling, e.g.:
> >
> >     builtin/init-db.c:              if (lstat(path->buf, &st_git)) {
> >     builtin/init-db.c-                      if (errno != ENOENT)
> >     builtin/init-db.c-                              die_errno(_("cannot stat '%s'"), path->buf);
> >     builtin/init-db.c-              }
> >
> > Shouldn't we do the same here and at least error() on return values of
> > -1 with an accompanying errno that isn't ENOENT?
>
> If we should do that everywhere, should we have an xlstat in wrapper.[ch]?

Turns out we already DO have a file_exists() wrapper function, but it's found in dir.c rather than wrapper.[ch]. However, it doesn't bother to check errno either...

Previous: Elijah NewrenNext: Victoria Dye
Message 29 of 30 in “Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts)”
  1. 0/5 Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts)Elijah Newren via GitGitGadget, Jan 13, 2022
  2. 1/5 t1011: add testcase demonstrating accidental loss of user modificationsElijah Newren via GitGitGadget, Jan 13, 2022
  3. 2/5 unpack-trees: fix accidental loss of user changesElijah Newren via GitGitGadget, Jan 13, 2022
  4. 3/5 repo_read_index: clear SKIP_WORKTREE bit from files present in worktreeElijah Newren via GitGitGadget, Jan 13, 2022
  5. 4/5 Update documentation related to sparsity and the skip-worktree bitElijah Newren via GitGitGadget, Jan 13, 2022
  6. 5/5 Accelerate clear_skip_worktree_from_present_files() by cachingElijah Newren via GitGitGadget, Jan 13, 2022
  7. Elijah NewrenJan 13, 2022
  8. 0/5 Remove the present-despite-SKIP_WORKTREE class of bugs (for sparse-checkouts)Elijah Newren via GitGitGadget, Jan 14, 2022
  9. 1/5 t1011: add testcase demonstrating accidental loss of user modificationsElijah Newren via GitGitGadget, Jan 14, 2022
  10. Ævar Arnfjörð BjarmasonFeb 16, 2022
  11. Elijah NewrenFeb 16, 2022
  12. 2/5 unpack-trees: fix accidental loss of user changesElijah Newren via GitGitGadget, Jan 14, 2022
  13. 3/5 repo_read_index: clear SKIP_WORKTREE bit from files present in worktreeElijah Newren via GitGitGadget, Jan 14, 2022
  14. Ævar Arnfjörð BjarmasonFeb 16, 2022
  15. Elijah NewrenFeb 16, 2022
  16. Jonathan NiederFeb 19, 2022
  17. Elijah NewrenFeb 19, 2022
  18. Jonathan NiederFeb 19, 2022
  19. Elijah NewrenFeb 20, 2022
  20. Derrick StoleeFeb 20, 2022
  21. Jonathan NiederFeb 22, 2022
  22. 4/5 Update documentation related to sparsity and the skip-worktree bitElijah Newren via GitGitGadget, Jan 14, 2022
  23. Ævar Arnfjörð BjarmasonFeb 16, 2022
  24. Elijah NewrenFeb 16, 2022
  25. 5/5 Accelerate clear_skip_worktree_from_present_files() by cachingElijah Newren via GitGitGadget, Jan 14, 2022
  26. Victoria DyeJan 15, 2022
  27. Ævar Arnfjörð BjarmasonFeb 16, 2022
  28. Elijah NewrenFeb 16, 2022
  29. Elijah NewrenFeb 17, 2022
  30. Victoria DyeJan 15, 2022

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.