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

Re: why still no empty directory support in git

From
Ddemerphq <demerphq@gmail.com>
Date
Dec 30, 2008, 08:43 UTC
Message-ID
<9b18b3110812300043l55a42f6sd995f36bf857543e@mail.gmail.com>
In-Reply-To
<alpine.DEB.2.00.0812300113050.22107@vellum.laroia.net>
2008/12/30 Asheesh Laroia <asheesh@asheesh.org>:
Show 26 quoted lines
> On Tue, 30 Dec 2008, Asheesh Laroia wrote:
>
>> On Tue, 30 Dec 2008, Ping Yin wrote:
>>
>>> 2. unclear logic, for example, whether to remove the directory after the
>>> last file in it is deleted
>>
>> This is the thing I dislike most about git: that it sometimes calls
>> rmdir() for me.  At least, one should be able to turn it off in a
>> per-repository basis.  I'm going to see how hard a patch that would be to
>> write.
>
> Well, changing this behavior seems to be "as easy as" changing unlink_entry
> in unpack_trees.c to not always rmdir(). The most naive thing I can think of
> is to have unlink_entry in unpack_trees check against the git config. It's
> probably more sensible for unpack_trees to be passed an argument that
> determines if it rmdir()s; that argument could be set via argv at "git
> unpack-tree" time, which could be set out of a configuration value read at
> "git" time.
>
> Would a change of the "more sensible" kind possibly be accepted by the git
> maintainer?
>
> I ask about this because I'm using git to track email in Maildir
> repositories, and in that vein I'm getting bitten by git's removal of empty
> directories.

Add a .exists to each directory. There is precedent for such an approach in other systems.

cheers, Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Previous: Asheesh LaroiaNext: Asheesh Laroia
Message 8 of 18 in “why still no empty directory support in git”
  1. Ping YinDec 30, 2008
  2. Asheesh LaroiaDec 30, 2008
  3. Jeff WhitesideDec 30, 2008
  4. Robin RosenbergDec 30, 2008
  5. Junio C HamanoDec 30, 2008
  6. Ping YinDec 30, 2008
  7. Asheesh LaroiaDec 30, 2008
  8. demerphqDec 30, 2008
  9. Asheesh LaroiaDec 30, 2008
  10. David BrownDec 31, 2008
  11. Jeff KingJan 1, 2009
  12. Johannes SchindelinJan 2, 2009
  13. Asheesh LaroiaJan 2, 2009
  14. Asheesh LaroiaJan 8, 2009
  15. Liu YubaoDec 30, 2008
  16. Anatol PomozovJan 1, 2009
  17. Johannes SchindelinDec 30, 2008
  18. Michael GaberDec 30, 2008

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.