sapling/eden/fs/inodes/test
Michael Bolin 8c19620e62 Support directories in Dirstate::computeDelta().
Summary:
Previous to this commit, the `Dirstate` logic only worked correctly when the
changes occurred in the root directory. Obviously that is very limiting, so this
adds support for changes in arbitrary directories at arbitrary depths.

This also introduces support for things like a file being replaced by a
directory of same name or vice versa. The tests have been updated to verify
these cases.

One interesting design change that fell out of this was the addition of the
`removedDirectories` field to the `DirectoryDelta` struct. As you can see,
all entries in a removed directory need to be processed by the new
`addDeletedEntries()` function. These require special handling because deleted
directories do not show up in the traversal of modified directories.

In contrast, new directories do show up in the traversal, so they require a
different type of special handling. Specifically, this call will return `NULL`:

```
auto tree = getTreeForDirectory(directory, rootTree.get(), objectStore);
```

When this happens, we must pass an empty vector of tree entries to
`computeDelta()` rather than `&tree->getTreeEntries()`. Admittedly, the special
case of new directories is much simpler than the special case of deleted ones.

Reviewed By: simpkins

Differential Revision: D4219478

fbshipit-source-id: 4c805ba3d7688c4d12ab2ced003a7f5c19ca07eb
2016-11-29 06:51:14 -08:00
..
DirstatePersistenceTest.cpp Flip Dirstate -> EdenMount dependency. 2016-11-26 12:01:41 -08:00
DirstateTest.cpp Support directories in Dirstate::computeDelta(). 2016-11-29 06:51:14 -08:00
EdenMountHandlerTest.cpp Flip Dirstate -> EdenMount dependency. 2016-11-26 12:01:41 -08:00
TARGETS Flip Dirstate -> EdenMount dependency. 2016-11-26 12:01:41 -08:00