diff --git a/src/libutil/fs-sink.hh b/src/libutil/fs-sink.hh index 6567d7aa7b1..5bdf60b92c8 100644 --- a/src/libutil/fs-sink.hh +++ b/src/libutil/fs-sink.hh @@ -95,7 +95,7 @@ struct RestoreSink : ParseSink void copyDirectory(const Path & source, const Path & destination) { Path p = dstPath + destination; - boost::filesystem::copy(source, p); + boost::filesystem::copy(source, p, boost::filesystem::copy_option::overwrite_if_exists); } }; diff --git a/src/libutil/git.cc b/src/libutil/git.cc index aa96fd9bd99..b926c9fe515 100644 --- a/src/libutil/git.cc +++ b/src/libutil/git.cc @@ -134,7 +134,7 @@ static void parse(ParseSink & sink, Source & source, const Path & path, const Pa throw SysError(format("file is a directory but expected to be a file '%1%'") % entry); sink.createDirectory(path + "/" + name); - sink.copyDirectory(realStoreDir + "/" + entryName, path + "/" + name); + sink.copyDirectory(entry, path + "/" + name, copy_option::overwrite_if_exists); } else throw Error(format("file '%1%' has an unsupported type") % entry); } } else throw Error("input doesn't look like a Git object");