Re: Adding empty directory gives bogus error message
- From
Jeff King <peff@peff.net>
- Date
- Jun 11, 2007, 12:30 UTC
- Message-ID
- <20070611123045.GA28814@coredump.intra.peff.net>
- In-Reply-To
- <20070610204648.GA32214@diku.dk>
On Sun, Jun 10, 2007 at 10:46:48PM +0200, Jonas Fonseca wrote:
Show 14 quoted lines
> During a talk with madduck on #git today, we stumbled upon this > confusing error message: > > $ mkdir repo > $ cd repo/ > $ git init > Initialized empty Git repository in .git/ > $ mkdir empty > $ git add empty/ > The following paths are ignored by one of your .gitignore files: > empty/ (directory) > Use -f if you really want to add them. > $ git add -f empty/ > fatal: unable to index file empty/
Urgh, that's ugly. The problem is that git-add sticks assumed-to-be-ignored stuff back into the list of files found by read_directory, but with some special ignored flags (which aren't used anywhere else!). When the assumption is wrong (because the path is _actually_ just empty), you get the bogus message, and when you try to force it, you get an error from elsewhere in the code.
Patch series will be out momentarily.
-Peff