about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-02-14T12·08+0100
committerGitHub <noreply@github.com>2019-02-14T12·08+0100
commitd8fe447139624082681e477900b0f7a798ff375a (patch)
tree18ac8e1ca283ba1f0fbcc89ab8ffa783901de4c1 /src
parent25722bd39aece28a3ab8ef05fa14cece37b8c8fe (diff)
parent5f1891b795c4c4daac5336d1ec60c94f521ede1d (diff)
Merge pull request #2579 from catern/dumpdb
nix-store: make --dump-db take a list of paths to dump
Diffstat (limited to 'src')
-rw-r--r--src/nix-store/nix-store.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index a9ad14762e62..33138baff388 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -485,11 +485,16 @@ static void opReadLog(Strings opFlags, Strings opArgs)
 static void opDumpDB(Strings opFlags, Strings opArgs)
 {
     if (!opFlags.empty()) throw UsageError("unknown flag");
-    if (!opArgs.empty())
-        throw UsageError("no arguments expected");
-    PathSet validPaths = store->queryAllValidPaths();
-    for (auto & i : validPaths)
-        cout << store->makeValidityRegistration({i}, true, true);
+    if (!opArgs.empty()) {
+        for (auto & i : opArgs)
+            i = store->followLinksToStorePath(i);
+        for (auto & i : opArgs)
+            cout << store->makeValidityRegistration({i}, true, true);
+    } else {
+        PathSet validPaths = store->queryAllValidPaths();
+        for (auto & i : validPaths)
+            cout << store->makeValidityRegistration({i}, true, true);
+    }
 }