#6699 flake init: fix trying to add unchanged file

After skipping because of being of identical content it tried to git add it.
This commit is contained in:
Manu [tennox] 2022-06-26 21:29:45 +01:00
parent 4374e3ec67
commit ae4c9ef8e2

View file

@ -777,6 +777,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
} else { } else {
notice("skipping identical file: %s", from2); notice("skipping identical file: %s", from2);
} }
continue;
} else } else
createSymlink(target, to2); createSymlink(target, to2);
} }
@ -789,7 +790,7 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
copyDir(templateDir, flakeDir); copyDir(templateDir, flakeDir);
if (pathExists(flakeDir + "/.git")) { if (!changedFiles.empty() && pathExists(flakeDir + "/.git")) {
Strings args = { "-C", flakeDir, "add", "--intent-to-add", "--force", "--" }; Strings args = { "-C", flakeDir, "add", "--intent-to-add", "--force", "--" };
for (auto & s : changedFiles) args.push_back(s); for (auto & s : changedFiles) args.push_back(s);
runProgram("git", true, args); runProgram("git", true, args);