forked from lix-project/lix
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().
This commit is contained in:
parent
455aa8d9ea
commit
8fc1c3f413
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue