Fixed single-file backup

pull/10/head
Dennis Schwerdel 2017-04-11 09:07:58 +02:00
parent e67ddbb275
commit 6b0090a062
1 changed files with 8 additions and 2 deletions

View File

@ -121,10 +121,16 @@ impl Repository {
} else { } else {
backup.file_count +=1; backup.file_count +=1;
// Non-directories are stored directly and the chunks are put into the children map of their parents // Non-directories are stored directly and the chunks are put into the children map of their parents
let chunks = try!(self.put_inode(&inode));
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
let parent = parent.to_owned(); let parent = parent.to_owned();
if let Some(ref mut parent) = directories.get_mut(&parent) { if !directories.contains_key(&parent) {
// This is a backup of one one file, put it in the directories map so it will be saved later
assert!(scan_stack.is_empty() && save_stack.is_empty() && directories.is_empty());
save_stack.push(path.clone());
directories.insert(path.clone(), inode);
} else {
let mut parent = directories.get_mut(&parent).unwrap();
let chunks = try!(self.put_inode(&inode));
let children = parent.children.as_mut().unwrap(); let children = parent.children.as_mut().unwrap();
children.insert(inode.name.clone(), chunks); children.insert(inode.name.clone(), chunks);
} }