On Wednesday 18 July 2007, Junio C Hamano wrote: > Didn't I say I do not have an objection for somebody who wants > to track empty directories, already? I probably would not do > that myself but I do not see a reason to forbid it, either. > > The right approach to take probably would be to allow entries of > mode 040000 in the index. Traditionally, we allowed only 100644 > (blobs as regular files) and 120000 (blobs as symlinks). We > recently added 160000 (commit from outer space, aka subproject). > > And we do that for all directories, not just empty ones. So if > you have fileA, empty/, sub/fileB tracked, your index would > probably have these four entries, immediately after read-tree > of an existing tree object: Sorry for jumping in late... Why do you want to add _all_ directories, and not just the ones we want to explicitly track (independent of whether they're empty or not). Basically, add a "--dir" flag to git-add, git-rm and friends, to tell them you're acting on the directory itself (rather than its (recursive) contents). "git-add --dir foo" will add the "040000 123abc... 0 foo" to the index/tree whether or not foo is an empty directory. "git-rm --dir foo" will remove that entry (or fail if it doesn't exist), but _not_ the contents of foo. Since we're making directory tracking _explicit_, this should all be trivially backward-compatible. ...Johan -- Johan Herland, <johan@xxxxxxxxxxx> www.herland.net - 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