Use "git add --force --intent-to-add" for flake.lock

Fixes

  The following paths are ignored by one of your .gitignore files:
  flake.lock
This commit is contained in:
Eelco Dolstra 2019-07-11 17:05:53 +02:00
parent ad42a78469
commit 0802e006f2
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -409,6 +409,8 @@ ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef, HandleLoc
// Hack: Make sure that flake.lock is visible to Git, so it ends up in the Nix store. // Hack: Make sure that flake.lock is visible to Git, so it ends up in the Nix store.
runProgram("git", true, { "-C", refData->path, "add", runProgram("git", true, { "-C", refData->path, "add",
"--force",
"--intent-to-add",
(topRef.subdir == "" ? "" : topRef.subdir + "/") + "flake.lock" }); (topRef.subdir == "" ? "" : topRef.subdir + "/") + "flake.lock" });
} else } else
warn("cannot write lockfile of remote flake '%s'", topRef); warn("cannot write lockfile of remote flake '%s'", topRef);