Merge pull request #514 from zorgiepoo/binary-delta-dir-change-issue

Fix BinaryDelta sometimes failing when a dir becomes a dir link
This commit is contained in:
Kornel committed 2015-04-04 23:37:36 +01:00
commit 3b8513546e
1 file changed
+15 -2
+15 -2
View File
@@ -206,10 +206,23 @@ int main(int __unused argc, char __unused *argv[])
NSDictionary *info = infoForFile(ent);
NSDictionary *oldInfo = originalTreeState[key];
if ([info isEqual:oldInfo])
if ([info isEqual:oldInfo]) {
[newTreeState removeObjectForKey:key];
else
} else {
newTreeState[key] = info;
if (oldInfo && [oldInfo[@"type"] unsignedShortValue] == FTS_D && [info[@"type"] unsignedShortValue] != FTS_D) {
NSArray *parentPathComponents = key.pathComponents;
for (NSString *childPath in originalTreeState) {
NSArray *childPathComponents = childPath.pathComponents;
if (childPathComponents.count > parentPathComponents.count &&
[parentPathComponents isEqualToArray:[childPathComponents subarrayWithRange:NSMakeRange(0, parentPathComponents.count)]]) {
[newTreeState removeObjectForKey:childPath];
}
}
}
}
}
fts_close(fts);