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

Re: [PATCH] Remove empty directories when checking out a commit with fewer submodules

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 11, 2010, 09:45 UTC
Message-ID
<alpine.DEB.1.00.1001111044140.4985@pacific.mpi-cbg.de>
In-Reply-To
<201001111032.45637.johan@herland.net>
Hi,
On Mon, 11 Jan 2010, Johan Herland wrote:
Show 33 quoted lines
> On Monday 11 January 2010, Johannes Schindelin wrote:
> > Hi,
> >
> > On Mon, 11 Jan 2010, Peter Collingbourne wrote:
> > > Change the unlink_entry function to use rmdir to remove submodule
> > > directories.
> >
> > NAK.  We should not even try to _unlink_ submodule subdirectories; it
> > would be _way_ too easy to lose data that way.  Remember, submodules
> > are a totally different beast from regular files.  They can contain
> > valuable, yet uncommitted data, that is not even meant to be
> > committed.
> >
> > So you say if the submodule directories are empty, it is safe?  Not
> > so. They will never be empty: there is always .git/, and _that_ can
> > contain valuable information that you do not want to throw away, too.
> >  Think of unpushed branches, for example.  That would be _fatal_ if
> > you rmdir() that for me.
> >
> > So please, no,
> 
> I believe what Peter is referring to is the _empty_ directories (and 
> that includes no .git/) that are placeholders for submodules that are 
> deliberately not cloned/checked out. This lets you do things like:
> 
> 	git clone url:to/some/project
> 	cd project
> 	git checkout some-other-branch-with-different-submodules
> 	git submodule update --init
> 
> Of course, once you clone/checkout a submodule, there will be contents 
> in that directory (including the .git/), and Git should not try to 
> remove it.

Yes, this might very well have been my confusion. Peter, could you please refer to such submodules as "uninitialized" rather than "empty" in the future? This would help simple minds like mine to understand you better.

Ciao, Dscho

Previous: Johan HerlandNext: Junio C Hamano
Message 4 of 5 in “Remove empty directories when checking out a commit with fewer submodules”
  1. Remove empty directories when checking out a commit with fewer submodulesPeter Collingbourne, Jan 11, 2010
  2. Johannes SchindelinJan 11, 2010
  3. Johan HerlandJan 11, 2010
  4. Johannes SchindelinJan 11, 2010
  5. Junio C HamanoJan 11, 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.