if the root Tree has only 1 node, named '.', set the nodeName property so that we correctly restore that single-file tree

This commit is contained in:
Stefan Reitshamer 2017-11-13 07:21:57 -05:00
parent f45caa607d
commit de70f21d91

View file

@ -520,6 +520,15 @@
nodeName = component;
}
}
} else {
Tree *rootTree = [repo treeForBlobKey:[commit treeBlobKey] error:error];
if (rootTree == nil) {
return NO;
}
if ([[rootTree childNodeNames] isEqualToArray:[NSArray arrayWithObject:@"."]]) {
// Single-file case.
nodeName = [[commit location] lastPathComponent];
}
}
NSString *restoreFileName = [args count] == 6 ? [[args objectAtIndex:5] lastPathComponent] : [[matchingBucket localPath] lastPathComponent];