updateLockFile: Do "git add" in a slightly nicer way

"--intent-to-add" ensures the change shows up in "git diff".
This commit is contained in:
Eelco Dolstra 2019-05-08 13:24:37 +02:00
parent b9c016abc1
commit 9d07c3717b
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -417,7 +417,7 @@ void updateLockFile(EvalState & state, const FlakeUri & flakeUri)
// Hack: Make sure that flake.lock is visible to Git. Otherwise,
// exportGit will fail to copy it to the Nix store.
runProgram("git", true,
{ "-C", refData->path, "add",
{ "-C", refData->path, "add", "--intent-to-add",
(flakeRef.subdir == "" ? "" : flakeRef.subdir + "/") + "flake.lock" });
} else
throw Error("flakeUri %s can't be updated because it is not a path", flakeUri);