From 291be6056ca58532105f0696d763393b83d7fda6 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 1 Jun 2020 16:50:41 -0500 Subject: [PATCH] Overwrite if directory exists in RestoreSink::copyDirectory --- src/libutil/fs-sink.hh | 2 +- src/libutil/git.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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");