about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/export-import.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T19·47+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T19·51+0100
commit39087321811e81e26a1a47d6967df1088dcf0e95 (patch)
tree57110be423eeb7869e9960466f4b17c0ea7cd961 /third_party/nix/src/libstore/export-import.cc
parentcf40d08908ede4061eb15513b770c98877844b8b (diff)
style(3p/nix): Final act in the brace-wrapping saga r/777
This last change set was generated by a full clang-tidy run (including
compilation):

    clang-tidy -p ~/projects/nix-build/ \
      -checks=-*,readability-braces-around-statements -fix src/*/*.cc

Actually running clang-tidy requires some massaging to make it play
nice with Nix + meson, I'll be adding a wrapper or something for that soon.
Diffstat (limited to 'third_party/nix/src/libstore/export-import.cc')
-rw-r--r--third_party/nix/src/libstore/export-import.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/export-import.cc b/third_party/nix/src/libstore/export-import.cc
index 930ff90d269e..6a1862492d1f 100644
--- a/third_party/nix/src/libstore/export-import.cc
+++ b/third_party/nix/src/libstore/export-import.cc
@@ -46,9 +46,10 @@ void Store::exportPath(const Path& path, Sink& sink) {
      filesystem corruption from spreading to other machines.
      Don't complain if the stored hash is zero (unknown). */
   Hash hash = hashAndWriteSink.currentHash();
-  if (hash != info->narHash && info->narHash != Hash(info->narHash.type))
+  if (hash != info->narHash && info->narHash != Hash(info->narHash.type)) {
     throw Error(format("hash of path '%1%' has changed from '%2%' to '%3%'!") %
                 path % info->narHash.to_string() % hash.to_string());
+  }
 
   hashAndWriteSink << exportMagic << path << info->references << info->deriver
                    << 0;
@@ -62,17 +63,19 @@ Paths Store::importPaths(Source& source, std::shared_ptr<FSAccessor> accessor,
     if (n == 0) {
       break;
     }
-    if (n != 1)
+    if (n != 1) {
       throw Error(
           "input doesn't look like something created by 'nix-store --export'");
+    }
 
     /* Extract the NAR from the source. */
     TeeSink tee(source);
     parseDump(tee, tee.source);
 
     uint32_t magic = readInt(source);
-    if (magic != exportMagic)
+    if (magic != exportMagic) {
       throw Error("Nix archive cannot be imported; wrong format");
+    }
 
     ValidPathInfo info;