about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nix-hash.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nix-hash.cc b/src/nix-hash.cc
index e35d0a1feda3..77c169b9a952 100644
--- a/src/nix-hash.cc
+++ b/src/nix-hash.cc
@@ -6,9 +6,13 @@
 
 void run(Strings args)
 {
-    for (Strings::iterator it = args.begin();
-         it != args.end(); it++)
-        cout << format("%1%\n") % (string) hashPath(*it);
+    bool flat = false;
+    for (Strings::iterator i = args.begin();
+         i != args.end(); i++)
+        if (*i == "--flat") flat = true;
+        else
+            cout << format("%1%\n") % (string) 
+                (flat ? hashFile(*i) : hashPath(*i));
 }