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

Re: [PATCH] Remove empty ref directories while reading loose refs

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 10, 2012, 19:09 UTC
Message-ID
<7v39aiqzda.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1328891127-17150-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>  I don't think the a few extra rmdir()s from time to time at startup
>  are going to cause any problems. Making delete_ref() delete empty
>  directories takes more effort and probably not worth it.

That reads as a very poorly phrased excuse for not solving the problem at the right location. Compared to all the codepaths that want to resolve ref, delete_ref() is run much less often, and it is where the problem you are solving (i.e. directories that have just become unnecessary are not removed) originates, no?

Wouldn't it be just the matter of replacing two unlink_or_warn() calls in delete_ref(), one for cleaning refs/ hierarchy and the other for cleaning logs/ hierarcy, with a new helper that calls unlink_or_warn() and then tries rmdir going upwards until it hits the limit, perhaps using a helper function that refactors dir.c::remove_path() that takes an extra parameter telling it where to stop?

Previous: Nguyễn Thái Ngọc DuyNext: Jeff King
Message 2 of 10 in “Remove empty ref directories while reading loose refs”
  1. Remove empty ref directories while reading loose refsNguyễn Thái Ngọc Duy, Feb 10, 2012
  2. Junio C HamanoFeb 10, 2012
  3. Jeff KingFeb 10, 2012
  4. 1/2 pack-refs: remove all empty directories under $GIT_DIR/refsNguyễn Thái Ngọc Duy, Feb 11, 2012
  5. 2/2 Revert be7c6d4 (pack-refs: remove newly empty directories)Nguyễn Thái Ngọc Duy, Feb 11, 2012
  6. Junio C HamanoFeb 11, 2012
  7. Nguyen Thai Ngoc DuyFeb 11, 2012
  8. Junio C HamanoFeb 11, 2012
  9. pack-refs: remove all empty dirs under .git/{refs,logs/refs}Nguyễn Thái Ngọc Duy, Feb 11, 2012
  10. Thomas AdamFeb 11, 2012

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.