Specify the behaviour when overwriting files, symlinks or directories
Background
When layering one artifact on top of another, we will find some directory entries which are the same in the existing directory tree as in the new tree. In most cases, the entry in the old world disappears and is replaced by the new one, except:
- Overwriting a directory with another directory should cause a merge, not a replacement
- Overwriting a symlink to a directory with another directory should cause a merge at the symlink's target.
These are probably obvious, but I think they should be explicitly stated.
The third case:
- Overwriting a file with a directory
Currently causes a crash in BuildStream. Should this be a straight replacement? We definitely need a test for it.
Task description
- Figure out the specification
- Add the rules to the documentation
- Add a test for these rules
Acceptance Criteria
-
Rules are explicitly stated in the documentation
-
Tests now cover all cases of replacing X with Y, where X and Y can be:
- An ordinary file
- A symlink to file
- A symlink to directory
- A broken symlink
- A directory