diff options
author | Manu [tennox] <2084639+tennox@users.noreply.github.com> | 2022-06-26 18:12:30 +0100 |
---|---|---|
committer | Manu [tennox] <2084639+tennox@users.noreply.github.com> | 2022-06-26 18:12:30 +0100 |
commit | 4374e3ec67a6c3ed8342908a5229437424926bf5 (patch) | |
tree | 2ada0cc9b80d55c98a9bb2fefaceb85274585c63 | |
parent | 58cbbdc5e78b952bfaf8ff36e9c94ccbd08469b7 (diff) |
#6699 flake init: Apply suggestions of @thufschmitt
-rw-r--r-- | src/nix/flake.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 10bbcaf43..1140548e7 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -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()); } }; |