All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Olivier LE ROY <olivier_le_roy@yahoo.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Handling empty directories in Git
Date: Tue, 08 Apr 2014 19:03:37 +0200	[thread overview]
Message-ID: <vpqob0blpna.fsf@anie.imag.fr> (raw)
In-Reply-To: <1396968442.95061.YahooMailNeo@web120806.mail.ne1.yahoo.com> (Olivier LE's message of "Tue, 8 Apr 2014 07:47:22 -0700 (PDT)")

Olivier LE ROY <olivier_le_roy@yahoo.com> 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/

  parent reply	other threads:[~2014-04-08 17:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 14:47 Handling empty directories in Git Olivier LE ROY
2014-04-08 17:02 ` Andrew Keller
2014-04-08 17:20   ` Andrew Keller
2014-04-08 17:47   ` Olivier LE ROY
2014-04-08 17:03 ` Matthieu Moy [this message]
2014-04-08 17:36   ` David Kastrup
2014-04-08 18:39     ` Olivier LE ROY
2014-04-08 18:06   ` Olivier LE ROY
2014-04-11 12:34 ` Øyvind A. Holm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqob0blpna.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=olivier_le_roy@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.