Closed dfandrich closed 9 years ago
Thanks, looks fine at very quick first glance. I'll check it more thoroughly some other day.
BTW Please make your future topic branches derived directly from origin/master, unless it's truly necessary to base them on some other topic branch - here it is definitely not. (If you want to check code from many branches together you can always create your own local copy branch and rebase it on top of other one and so on...)
I combined this branch one with the DEBUG one since you said you'd be merging it, and this way it avoids an annoying merge commit.
I have to say (finally, after so many months, sorry!) that I don't like this simpleminded algorithm. Being simple isn't necessarily wrong, but it is too naive and quite expensive, especially for bigger sets of nested directories as you already commented in the code (I haven't performed the tests yet to see how it actually behaves in practice).
Other (minor) nitpicks are:
fixup_newemptydirs()
(4 spaces instead of tab),The algorithm may not win any contests from an algorithmic point of view, but it's a giant win for simplicity, and remains completely acceptable from a practical standpoint. For example, I extracted the Linux 3.19 tree, removed the files and ran metastore to delete all 3122 directories and it took 154 ms.
I've dealt with your nitpicks except for the one about maintaining extradirs, which I'm not sure about. extradirs is handled exactly the same way as missingdirs and missingothers. If you're talking about freeing the structure before exit, I don't see the point. It would be just wasting cycles compared to letting the OS free the memory in one go at process exit time. And you can't do something like memory leak detection anyway unless every such instance is changed.
Fair enough. Applied with small corrections in b6f60de37d17 and improved in further commits. Thanks.
github's default title leave too much to the imagination. This should have been titled Add support for deleting directories with -a -E. This fixes (#10).