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

Re: Empty directories in Git: Current guidance for historical commits?

From
Torsten Bögershausen <tboegi@web.de>
Date
Sep 5, 2017, 17:58 UTC
Message-ID
<f8ed8f0b-a2e1-9e7a-bf79-2b7629b838f2@web.de>
In-Reply-To
<20170905124743.Horde.bgYg8gUhE6ubSHtPAr3lCGl@vfemail.net>
On 2017-09-05 14:47, wafflecode@openmail.cc wrote:
Show 21 quoted lines
> 
> Hello,
> 
> Per the FAQ it's clear that Git (by current design) does not track empty
> directories: 
> https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F
> 
> That's fine and I can fix that for my code going forward via the build system,
> as needed.
> 
> However I'm looking to import a fairly deep (10k+ commits) svn history in to Git
> and I'm wondering what the current best practices are for dealing with empty
> folders?   Meaning to say, I'd like to be able to check out an older revision of
> the code and have it build correctly using the older build system which expects
> certain folders to exist.
> 
> There are a few different answers floating around the net, so I figured I'd
> confirm via the mailing list.
> 
> Is just dropping a ".gitignore" or "README" file in the empty directories during
> conversion still the most reasonable approach? 

A .gitignore will, but may cost 0.001% CPU time when running "git status". I have seen systems that create a file called ".empty" in every directory.

> If so, is there a way to do this
> automatically during the conversion using "git svn" or the like?

Not what I am aware of. And even if, the .empty files need to be removed, once the directory is removed. And we don't have logic for that, as far as I know.

That would be by suggestion: convert the repo "as is", with the tools we have.

If you need to continue to work on an old branch (or the master branch), add the .empty file, where needed, and continue to work in Git, on a branch as usual.

Show 5 quoted lines
> 
> 
> Thank you
> David
>
Previous: wafflecode@openmail.ccNext: wafflecode@openmail.cc
Message 2 of 4 in “Empty directories in Git: Current guidance for historical commits?”
  1. wafflecode@openmail.ccSep 5, 2017
  2. Torsten BögershausenSep 5, 2017
  3. wafflecode@openmail.ccSep 5, 2017
  4. Jeff KingSep 5, 2017

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.