diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2022-05-18 16:46:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 16:46:13 +0200 |
commit | 452ffe5464f20ac44a01c536349895d138150a96 (patch) | |
tree | 0d55f43b2cfee65feb21c214dd1e43b58723d0cb /src/nix | |
parent | 78dc64ec1e34236d90c8869feebe30f596205cb2 (diff) |
Hint at the source file on conflict in `flake new`
Add a pointer to the source file (from the template) when `nix flake new` (or `init`) encounters an already existing file
Fix #6542
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/flake.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 1938ce4e6..a1edb5dbf 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -758,7 +758,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand if (pathExists(to2)) { auto contents2 = readFile(to2); if (contents != contents2) - throw Error("refusing to overwrite existing file '%s'", to2); + throw Error("refusing to overwrite existing file '%s' - please merge manually with '%s'", to2, from2); } else writeFile(to2, contents); } @@ -766,7 +766,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand auto target = readLink(from2); if (pathExists(to2)) { if (readLink(to2) != target) - throw Error("refusing to overwrite existing symlink '%s'", to2); + throw Error("refusing to overwrite existing symlink '%s' - please merge manually with '%s'", to2, from2); } else createSymlink(target, to2); } |