about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/primops
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libexpr/primops')
-rw-r--r--third_party/nix/src/libexpr/primops/context.cc12
-rw-r--r--third_party/nix/src/libexpr/primops/fetchGit.cc12
-rw-r--r--third_party/nix/src/libexpr/primops/fetchMercurial.cc8
3 files changed, 24 insertions, 8 deletions
diff --git a/third_party/nix/src/libexpr/primops/context.cc b/third_party/nix/src/libexpr/primops/context.cc
index 13faeef8ce9c..1ae3219f2c61 100644
--- a/third_party/nix/src/libexpr/primops/context.cc
+++ b/third_party/nix/src/libexpr/primops/context.cc
@@ -111,7 +111,9 @@ static void prim_getContext(EvalState& state, const Pos& pos, Value** args,
   for (const auto& info : contextInfos) {
     auto& infoVal = *state.allocAttr(v, state.symbols.create(info.first));
     state.mkAttrs(infoVal, 3);
-    if (info.second.path) mkBool(*state.allocAttr(infoVal, sPath), true);
+    if (info.second.path) {
+      mkBool(*state.allocAttr(infoVal, sPath), true);
+    }
     if (info.second.allOutputs)
       mkBool(*state.allocAttr(infoVal, sAllOutputs), true);
     if (!info.second.outputs.empty()) {
@@ -147,11 +149,15 @@ static void prim_appendContext(EvalState& state, const Pos& pos, Value** args,
     if (!state.store->isStorePath(i.name))
       throw EvalError("Context key '%s' is not a store path, at %s", i.name,
                       i.pos);
-    if (!settings.readOnlyMode) state.store->ensurePath(i.name);
+    if (!settings.readOnlyMode) {
+      state.store->ensurePath(i.name);
+    }
     state.forceAttrs(*i.value, *i.pos);
     auto iter = i.value->attrs->find(sPath);
     if (iter != i.value->attrs->end()) {
-      if (state.forceBool(*iter->value, *iter->pos)) context.insert(i.name);
+      if (state.forceBool(*iter->value, *iter->pos)) {
+        context.insert(i.name);
+      }
     }
 
     iter = i.value->attrs->find(sAllOutputs);
diff --git a/third_party/nix/src/libexpr/primops/fetchGit.cc b/third_party/nix/src/libexpr/primops/fetchGit.cc
index 7fbd4dc92cf0..818a475f5ecd 100644
--- a/third_party/nix/src/libexpr/primops/fetchGit.cc
+++ b/third_party/nix/src/libexpr/primops/fetchGit.cc
@@ -37,7 +37,9 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
       runProgram("git", true,
                  {"-C", uri, "diff-index", "--quiet", "HEAD", "--"});
     } catch (ExecError& e) {
-      if (!WIFEXITED(e.status) || WEXITSTATUS(e.status) != 1) throw;
+      if (!WIFEXITED(e.status) || WEXITSTATUS(e.status) != 1) {
+        throw;
+      }
       clean = false;
     }
 
@@ -78,7 +80,9 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
     ref = "HEAD"s;
   }
 
-  if (!ref) ref = "HEAD"s;
+  if (!ref) {
+    ref = "HEAD"s;
+  }
 
   if (rev != "" && !std::regex_match(rev, revRegex))
     throw Error("invalid Git revision '%s'", rev);
@@ -166,7 +170,9 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
     }
 
   } catch (SysError& e) {
-    if (e.errNo != ENOENT) throw;
+    if (e.errNo != ENOENT) {
+      throw;
+    }
   }
 
   // FIXME: should pipe this, or find some better way to extract a
diff --git a/third_party/nix/src/libexpr/primops/fetchMercurial.cc b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
index 3de42fe770dc..392dbcb00837 100644
--- a/third_party/nix/src/libexpr/primops/fetchMercurial.cc
+++ b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
@@ -73,7 +73,9 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
     }
   }
 
-  if (rev == "") rev = "default";
+  if (rev == "") {
+    rev = "default";
+  }
 
   Path cacheDir = fmt("%s/nix/hg/%s", getCacheDir(),
                       hashString(htSHA256, uri).to_string(Base32, false));
@@ -149,7 +151,9 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
     }
 
   } catch (SysError& e) {
-    if (e.errNo != ENOENT) throw;
+    if (e.errNo != ENOENT) {
+      throw;
+    }
   }
 
   Path tmpDir = createTempDir();