diff options
author | Manu [tennox] <2084639+tennox@users.noreply.github.com> | 2022-06-26 21:29:45 +0100 |
---|---|---|
committer | Manu [tennox] <2084639+tennox@users.noreply.github.com> | 2022-06-26 21:35:21 +0100 |
commit | ae4c9ef8e284eabf3624d9e9ad0f0b432e06da41 (patch) | |
tree | b64599fbb98674d02e9f4e882f25c280eeaac7e4 | |
parent | 4374e3ec67a6c3ed8342908a5229437424926bf5 (diff) |
#6699 flake init: fix trying to add unchanged file
After skipping because of being of identical content it tried to git add it.
-rw-r--r-- | src/nix/flake.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 1140548e7..895a7de76 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -777,6 +777,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand } else { notice("skipping identical file: %s", from2); } + continue; } else createSymlink(target, to2); } @@ -789,7 +790,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand copyDir(templateDir, flakeDir); - if (pathExists(flakeDir + "/.git")) { + if (!changedFiles.empty() && pathExists(flakeDir + "/.git")) { Strings args = { "-C", flakeDir, "add", "--intent-to-add", "--force", "--" }; for (auto & s : changedFiles) args.push_back(s); runProgram("git", true, args); |