Fix directory rename hiding files from lower branches #152
+126
−19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #91
This PR fixes the old issue #91 with directory rename. Previously after renaming a directory, only the contents of the highest branch were cow-copied up to the read-write branch, hiding all content the directory had in lower branches. In this PR a new function is introduced that can do a cow-copy recursively for a directory tree in every branch. Now if a file is renamed and it's a non-directory, we do a normal cow-copy, but for directories we do this recursive cow-copy instead. Everything should now work as expected from a proper directory rename.
Doing a cow-copy recursively for a whole directory is significantly more complex that for a single file:
Caveat: directory renaming is now much slower than before. That's the price of it working correctly.