From de70f21d91611025c24d86823f81f5f0a29d4a2e Mon Sep 17 00:00:00 2001 From: Stefan Reitshamer Date: Mon, 13 Nov 2017 07:21:57 -0500 Subject: [PATCH] if the root Tree has only 1 node, named '.', set the nodeName property so that we correctly restore that single-file tree --- ArqRestoreCommand.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ArqRestoreCommand.m b/ArqRestoreCommand.m index e4b5494..27ed627 100644 --- a/ArqRestoreCommand.m +++ b/ArqRestoreCommand.m @@ -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];