about summary refs log tree commit diff
path: root/src/nix/installables.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-05-02T13·28+0200
committerEelco Dolstra <edolstra@gmail.com>2017-05-02T13·46+0200
commitcef8c169b1d100685d7c7b7bfb921eaa43b5521b (patch)
tree5d41d3c354cc98ed744e9b0ba939c8d112f42f6a /src/nix/installables.cc
parent7dedd3fa2455f1e219bc671d04d1dd1eaec54dfa (diff)
Fix "nix ... --all"
When "--all" is used, we should not fill in a default installable.
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r--src/nix/installables.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index 57580049f25f..4756fc44bba7 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -177,21 +177,21 @@ struct InstallableAttrPath : Installable
 std::string attrRegex = R"([A-Za-z_][A-Za-z0-9-_+]*)";
 static std::regex attrPathRegex(fmt(R"(%1%(\.%1%)*)", attrRegex));
 
-std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables(ref<Store> store, Strings installables)
+std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables(ref<Store> store, Strings ss)
 {
     std::vector<std::shared_ptr<Installable>> result;
 
-    if (installables.empty()) {
+    if (ss.empty() && useDefaultInstallables()) {
         if (file == "")
             file = ".";
-        installables = Strings{""};
+        ss = Strings{""};
     }
 
-    for (auto & installable : installables) {
+    for (auto & s : ss) {
 
-        if (installable.find("/") != std::string::npos) {
+        if (s.find("/") != std::string::npos) {
 
-            auto path = store->toStorePath(store->followLinksToStore(installable));
+            auto path = store->toStorePath(store->followLinksToStore(s));
 
             if (store->isStorePath(path)) {
                 if (isDerivation(path))
@@ -201,14 +201,14 @@ std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables
             }
         }
 
-        else if (installable.compare(0, 1, "(") == 0)
-            result.push_back(std::make_shared<InstallableExpr>(*this, installable));
+        else if (s.compare(0, 1, "(") == 0)
+            result.push_back(std::make_shared<InstallableExpr>(*this, s));
 
-        else if (installable == "" || std::regex_match(installable, attrPathRegex))
-            result.push_back(std::make_shared<InstallableAttrPath>(*this, installable));
+        else if (s == "" || std::regex_match(s, attrPathRegex))
+            result.push_back(std::make_shared<InstallableAttrPath>(*this, s));
 
         else
-            throw UsageError("don't know what to do with argument ‘%s’", installable);
+            throw UsageError("don't know what to do with argument ‘%s’", s);
     }
 
     return result;