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

Re: empty directories and git

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 16, 2010, 20:02 UTC
Message-ID
<m3aanhlapl.fsf_-_@localhost.localdomain>
In-Reply-To
<CDEB2042-A498-4950-A3CD-27F111455234@sb.org>
Kevin Ballard <kevin@sb.org> writes:
> On Sep 16, 2010, at 1:32 AM, Andreas Ericsson wrote:
> 
> > You can't have empty directories in git.
Show 9 quoted lines
> Apologies to those who were CC'd on the original message, I'm
> resending to this list as I forgot to set plain text.
> 
> I've always wondered about that. Why do we still have this
> restriction? There is a sha1 hash that is equivalent to the empty
> tree (4b825dc642cb6eb9a060e54bf8d69288fbee4904). Why can't git just
> use that to represent an empty directory? I imagine things that
> touch the working copy may need to be updated to be aware of this,
> but the problem doesn't seem insurmountable.

If I understand it correctly the problem is that git index is flat structure that contains only file (blob) info; there is currently no place in it to store information that some empty directory was added.

Adding an extension to have directories in index was considered in the past; it could even speed up git a bit, I think.

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Kevin Ballard
Message 4 of 4 in “empty directories and git Question”
  1. AntonSep 16, 2010
  2. Andreas EricssonSep 16, 2010
  3. Kevin BallardSep 16, 2010
  4. Jakub NarebskiSep 16, 2010

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.