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

Re: [PATCH/RFC v3 0/4] Improving performance of git clean

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 19, 2015, 01:14 UTC
Message-ID
<xmqqfv7wor6e.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1429389672-30209-1-git-send-email-erik.elfstrom@gmail.com>
Erik Elfström <erik.elfstrom@gmail.com> writes:
> Known Problems:
> * Unsure about the setup.c:read_gitfile refactor, feels a bit
>   messy?

The interface indeed feels somewhat messy. I suspect that a better interface might be more like setup_git_directory_gently() that is a gentler version of setup_git_directory(). The function takes an optional pointer to an int, and it behaves not-gently-at-all when the optional argument is NULL. The location the optional pointer points at, when it is not NULL, can be used to return the error state to the caller. That function pair only uses the optional argument to convey one bit of information (i.e. "are we in any git repository or not?") back to the caller, but the interface could be used to tell the caller a lot more if we wanted to.

If you model read_gitfile_gently() after that pattern, I would expect that

 - The extra pattern would be "int *error";
 - The implementation of read_gitfile() would be
       #define read_gitfile(path) read_gitfile_gently((path), NULL)
   and the _gently() version will die when "error" parameter is set
   to NULL and finds any error.
 - The caller of the gentle variant can use the error code to
   determine what went wrong, not just the fact that it failed.  I
   do not think your caller does not have an immediate need to tell
   between "invalid gitfile format" and "No path in gitfile", but
   such an interface leaves that possibility open.
Thanks.
Previous: Erik ElfströmNext: erik elfström
Message 6 of 14 in “Improving performance of git clean”
  1. 0/4 Improving performance of git cleanErik Elfström, Apr 18, 2015
  2. 1/4 setup: add gentle version of read_gitfileErik Elfström, Apr 18, 2015
  3. 2/4 t7300: add tests to document behavior of clean and nested gitErik Elfström, Apr 18, 2015
  4. 3/4 p7300: add performance tests for cleanErik Elfström, Apr 18, 2015
  5. 4/4 clean: improve performance when removing lots of directoriesErik Elfström, Apr 18, 2015
  6. Junio C HamanoApr 19, 2015
  7. erik elfströmApr 21, 2015
  8. Thomas GummererApr 20, 2015
  9. erik elfströmApr 21, 2015
  10. Junio C HamanoApr 21, 2015
  11. Jeff KingApr 21, 2015
  12. erik elfströmApr 22, 2015
  13. Jeff KingApr 22, 2015
  14. erik elfströmApr 22, 2015

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.