Skip to content

Commit

Permalink
if the root Tree has only 1 node, named '.', set the nodeName propert…
Browse files Browse the repository at this point in the history
…y so that we correctly restore that single-file tree
  • Loading branch information
sreitshamer committed Nov 13, 2017
1 parent f45caa6 commit de70f21
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ArqRestoreCommand.m
Expand Up @@ -520,6 +520,15 @@ - (BOOL)restore:(NSArray *)args error:(NSError **)error {
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];
Expand Down

0 comments on commit de70f21

Please sign in to comment.