#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:
parent
4374e3ec67
commit
ae4c9ef8e2
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue