Re: Tracking empty directories
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Feb 1, 2011, 17:54 UTC
- Message-ID
- <AANLkTi=u6=mhOd9LFYRy48y41xRcXmYDtktOKoBjjMgO@mail.gmail.com>
- In-Reply-To
- <20110201172835.GA3771@burratino>
On Wed, Feb 2, 2011 at 12:28 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 13 quoted lines
> Jakub Narebski wrote: > >> Also one needs to remember that this would require adding extension >> to git index, because currently it tracks only files, and not >> directories. Explicitly tracking directories in the index could be >> useful for other purposes... >> >> The major difficulty of this is IMHO not the UI, but tracking all those >> tricky corner cases (like directory/file conflict, etc.). > > I have ideas about how to resolve those tricky corner cases, but not > about what the UI should look like. How does one go about adding a > directory? Does it ever get implicitly removed?
I suppose a special command for it is appropriate (git-keepdir?). Many index-related commands are recursive by default and hard to change.
Yes I think it should be automatically removed from index when a file is added inside tracked directories. Removing those files will also remove the containing directory though.
> Would this actually require an index extension, strictly speaking?
Could it be done with an index extension? Interesting.
> Certainly one ought to register an extension name or bump the version > number to avoid confusing gits that don't know about the feature.
Index extension with lowercase name are "necessary for correct operation". Older git will abort on unknown required extensions. If you add to the main part of the index, better bump version number.
> But after that, couldn't we (e.g.) allow the directory name (ending > with '/') as index entry?
You could. You also need to strip '/' sometimes because certain part of git does not expect '/' to be there (traverse_trees or unpack_trees, I don't remember).
-- Duy