Re: Handling empty directories in Git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mattieu,

thanks for this answer. It is clear enough.

Olivier LE ROY




----- Mail original -----
De : Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx>
À : Olivier LE ROY <olivier_le_roy@xxxxxxxxx>
Cc : "git@xxxxxxxxxxxxxxx" <git@xxxxxxxxxxxxxxx>
Envoyé le : Mardi 8 avril 2014 17h03
Objet : Re: Handling empty directories in Git

Olivier LE ROY <olivier_le_roy@xxxxxxxxx> writes:

> The solution: put a .gitignore file in each empty directory to have them recognized by the Git database cannot work, because some scripts in my projects test the actual emptiness of the directories.

Another option is to have a post-checkout hook that does the mkdir for
you. Or do that in the build system if your use case is to store
untracked generated files in the directory.

> Is there any expert able to tell me: this cannot be done in Git, or
> this can be done by the following trick,

https://git.wiki.kernel.org/index.php/Git_FAQ#Can_I_add_empty_directories.3F

Short answer: it cannot be done.


> or why there is no valuable reason to maintain empty directories under
> version control?

The reason would be closer to "there is a valuable reason, but not
valuable enough to change Git to do it". It's actually not so easy to
track directories properly. Storing them in the Git repository is
actually possible (actually, an empty tree is a special case of this,
and is obviously supported), but defining and implementing a decent
behavior for each Git command wrt this is not trivial.

David Kastrup gave it a try a few years ago. I don't remember exactly
what made him give up, but it was never completed and merged.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]