Oh, man, I'd forgotten about these negated .gitignore patterns entirely. It actually hadn't occurred to me that they could override the behaviour of ignoring empty directories.
This is potentially actually useful for me, because I have a project with test data that consists of miniature filesystem sub-trees — that should include empty directories to ensure edge cases are covered. I've been zipping them up and having the test harness unpack them in the test environment, but that's an unnecessary extra point of failure (and it stuffs undiffable binary files into the commit history).
Edit: Ah, no, if this doesn't work from the project-global .gitignore (specifying a folder to keep, even though it's empty and doesn't even have its own .gitignore) then it doesn't solve the problem. :(
Why not having a txt file with indented tree, a bootstrap function that parses the file and creates the tree and a test for that function?
You will have proper diff for the tree this way.
Well, partly because I already have a tool similar to that in mind as a separate project :) (The files also need to have certain content, so I need something a bit more complex that can specify that.)
But mainly because, as you acknowledge, that process needs its own tests. Basic unzipping functionality is already tested for me.