prune: do not prune beyond an optional base directory, and add a test