[cache_repair] Avoid touching the output file by checking input file earlier

The output file has been checked by the caller, so there's no need
to check the output file again.
This commit is contained in:
Ming-Hung Tsai 2021-09-10 23:35:56 +08:00
parent 5abb92838c
commit 6bd7741dfa

View File

@ -32,7 +32,7 @@ namespace {
int repair(string const &old_path, string const &new_path) {
bool metadata_touched = false;
try {
file_utils::check_file_exists(new_path, false);
file_utils::check_file_exists(old_path, false);
metadata_touched = true;
metadata_dump(open_metadata_for_read(old_path),
output_emitter(new_path),