mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
#6699 flake init: Apply suggestions of @thufschmitt
This commit is contained in:
parent
58cbbdc5e7
commit
4374e3ec67
1 changed files with 2 additions and 5 deletions
|
@ -742,7 +742,6 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
|
|||
|
||||
std::vector<Path> changedFiles;
|
||||
std::vector<Path> conflictedFiles;
|
||||
auto success = false;
|
||||
|
||||
std::function<void(const Path & from, const Path & to)> copyDir;
|
||||
copyDir = [&](const Path & from, const Path & to)
|
||||
|
@ -761,7 +760,6 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
|
|||
auto contents2 = readFile(to2);
|
||||
if (contents != contents2) {
|
||||
printError("refusing to overwrite existing file '%s'\n please merge it manually with '%s'", to2, from2);
|
||||
success = false;
|
||||
conflictedFiles.push_back(to2);
|
||||
} else {
|
||||
notice("skipping identical file: %s", from2);
|
||||
|
@ -775,7 +773,6 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
|
|||
if (pathExists(to2)) {
|
||||
if (readLink(to2) != target) {
|
||||
printError("refusing to overwrite existing file '%s'\n please merge it manually with '%s'", to2, from2);
|
||||
success = false;
|
||||
conflictedFiles.push_back(to2);
|
||||
} else {
|
||||
notice("skipping identical file: %s", from2);
|
||||
|
@ -803,8 +800,8 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
|
|||
notice(renderMarkdownToTerminal(welcomeText->getString()));
|
||||
}
|
||||
|
||||
if (!success)
|
||||
throw Error("Encountered %d conflicts - please merge manually", conflictedFiles.size());
|
||||
if (!conflictedFiles.empty())
|
||||
throw Error("Encountered %d conflicts - see above", conflictedFiles.size());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue