threads / discuss / 7797

empty directories

Subject: empty directories

## tl;dr

3 messages between Apr 23, 2007 and Apr 23, 2007.

replies: 2people: 2as markdown or json

Yakov Lerner· Apr 23, 2007, 15:40 UTC · lore

When I git-add empty directory (mkdir d1;git-add d1), git refuses to add it [1].

I was told on #git chan that git cannot store empty dirs.
But when I do
         git-add -f emptyDir # where emptyDir is empty dir
, emptyDir is added and then cloned. What does it mean ?

Does it mean that if i git-add emptyDir with -f, it may break something in the repo ? That I shall not try it ? Or it is ok ?

Thanks Yakov ..................................................................... [1] $ mkdir emptyDir $ git-add emptyDir The following paths are ignored by one of your .gitignore files: emptyDir (directory) Use -f if you really want to add them. $ Note that the printed warning is misleading. The name (emptyDir) is not in any .gitignore files. It would be better to print the real reason for ignoring, no ?

Alex Riesen· Apr 23, 2007, 16:19 UTC · re: Yakov Lerner · lore

Re: empty directories

On 4/23/07, Yakov Lerner <iler.ml@gmail.com> wrote:
> When I git-add empty directory (mkdir d1;git-add d1),
> git refuses to add it [1].
>
> I was told on #git chan that git cannot store empty dirs.
It can, just refuses to. Which considered good by most
> But when I do
>          git-add -f emptyDir # where emptyDir is empty dir
> , emptyDir is added and then cloned. What does it mean ?

$ git add -f emptyDir fatal: unable to index file emptyDir

> Does it mean that if i git-add emptyDir with -f, it may break
> something in the repo ? That I shall not try it ? Or it is ok ?

It is not ok and it does not break anything. What git do you have, as I apparently cannot reproduce it.

Yakov Lerner· Apr 23, 2007, 16:49 UTC · re: Alex Riesen · lore

Re: empty directories

On 4/23/07, Alex Riesen <raa.lkml@gmail.com> wrote:
Show 20 quoted lines
> On 4/23/07, Yakov Lerner <iler.ml@gmail.com> wrote:
> > When I git-add empty directory (mkdir d1;git-add d1),
> > git refuses to add it [1].
> >
> > I was told on #git chan that git cannot store empty dirs.
>
> It can, just refuses to. Which considered good by most
>
> > But when I do
> >          git-add -f emptyDir # where emptyDir is empty dir
> > , emptyDir is added and then cloned. What does it mean ?
>
> $ git add -f emptyDir
> fatal: unable to index file emptyDir
>
> > Does it mean that if i git-add emptyDir with -f, it may break
> > something in the repo ? That I shall not try it ? Or it is ok ?
>
> It is not ok and it does not break anything. What git do you
> have, as I apparently cannot reproduce it.

It was 1.5.1. In 1.5.1.2, it refuses to add, yes. The message is: fatal: emptyDir/../emptyDir: can only add regular files or symbolic links

Yakov

← back to recent threads