diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-05-08 22:08:38 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-05-08 22:09:18 +0200 |
commit | 8fc1c3f413c20b4519a41e38365aa71fa06a5aae (patch) | |
tree | 9782dfd7bfcd63a87553b032856d54728c1b3da8 | |
parent | 455aa8d9ea55d3ea661b3c6f93e3ed5a43a82746 (diff) |
Fix assertion failure in FlakeRef::to_string()
Fixes
$ nix build
nix: src/libexpr/primops/flakeref.cc:169: std::__cxx11::string nix::FlakeRef::to_string() const: Assertion `!rev' failed.
Aborted
e.g. when flake.nix doesn't exist.
Also use gitRev().
-rw-r--r-- | src/libexpr/primops/flakeref.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/primops/flakeref.cc b/src/libexpr/primops/flakeref.cc index 784a0868e..3842b3f1a 100644 --- a/src/libexpr/primops/flakeref.cc +++ b/src/libexpr/primops/flakeref.cc @@ -161,13 +161,13 @@ std::string FlakeRef::to_string() const if (auto refData = std::get_if<FlakeRef::IsAlias>(&data)) { string = refData->alias; if (ref) string += '/' + *ref; - if (rev) string += '/' + rev->to_string(Base16, false); + if (rev) string += '/' + rev->gitRev(); } else if (auto refData = std::get_if<FlakeRef::IsPath>(&data)) { assert(subdir == ""); - assert(!rev); - assert(!ref); + if (ref) addParam("ref", *ref); + if (rev) addParam("rev", rev->gitRev()); return refData->path; } @@ -175,7 +175,7 @@ std::string FlakeRef::to_string() const assert(!(ref && rev)); string = "github:" + refData->owner + "/" + refData->repo; if (ref) { string += '/'; string += *ref; } - if (rev) { string += '/'; string += rev->to_string(Base16, false); } + if (rev) { string += '/'; string += rev->gitRev(); } if (subdir != "") addParam("dir", subdir); } @@ -186,7 +186,7 @@ std::string FlakeRef::to_string() const if (ref) { addParam("ref", *ref); if (rev) - addParam("rev", rev->to_string(Base16, false)); + addParam("rev", rev->gitRev()); } if (subdir != "") addParam("dir", subdir); |