diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-05-03 13:15:13 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-05-03 13:15:13 +0200 |
commit | f8c4742c2f92c7ba4dbe0911fb91ddce33c6f98a (patch) | |
tree | 8a2b99ae23c3768b068b25b55e1475442840fe4b /src | |
parent | 2aafa6901ec473d0e665a1f36166b443ad793f88 (diff) |
Fix 'git add' when subdir is empty
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops/flake.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc index 1c20d33bb..ab797fe01 100644 --- a/src/libexpr/primops/flake.cc +++ b/src/libexpr/primops/flake.cc @@ -430,7 +430,9 @@ 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", flakeRef.subdir + "/flake.lock" }); + runProgram("git", true, + { "-C", refData->path, "add", + (flakeRef.subdir == "" ? "" : flakeRef.subdir + "/") + "flake.lock" }); } else throw Error("flakeUri %s can't be updated because it is not a path", flakeUri); } |