about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/ssh.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T17·55+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T17·55+0100
commit867055133d3f487e52dd44149f76347c2c28bf10 (patch)
treec367803ad94f024b0052727a2c7a037af169169a /third_party/nix/src/libstore/ssh.cc
parentc6a31838cd7e88ebcb01422b329a499d04ab4b6b (diff)
style(3p/nix): Add braces around single-line conditionals r/771
These were not caught by the previous clang-tidy invocation, but were
instead sorted out using amber[0] as such:

    ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }'

[0]: https://github.com/dalance/amber
Diffstat (limited to 'third_party/nix/src/libstore/ssh.cc')
-rw-r--r--third_party/nix/src/libstore/ssh.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/third_party/nix/src/libstore/ssh.cc b/third_party/nix/src/libstore/ssh.cc
index 6a2eee59655e..20add33c0046 100644
--- a/third_party/nix/src/libstore/ssh.cc
+++ b/third_party/nix/src/libstore/ssh.cc
@@ -17,8 +17,12 @@ SSHMaster::SSHMaster(const std::string& host, const std::string& keyFile,
 void SSHMaster::addCommonSSHOpts(Strings& args) {
   for (auto& i : tokenizeString<Strings>(getEnv("NIX_SSHOPTS")))
     args.push_back(i);
-  if (!keyFile.empty()) args.insert(args.end(), {"-i", keyFile});
-  if (compress) args.push_back("-C");
+  if (!keyFile.empty()) {
+    args.insert(args.end(), {"-i", keyFile});
+  }
+  if (compress) {
+    args.push_back("-C");
+  }
 }
 
 std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(
@@ -81,11 +85,15 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(
 }
 
 Path SSHMaster::startMaster() {
-  if (!useMaster) return "";
+  if (!useMaster) {
+    return "";
+  }
 
   auto state(state_.lock());
 
-  if (state->sshMaster != -1) return state->socketPath;
+  if (state->sshMaster != -1) {
+    return state->socketPath;
+  }
 
   state->tmpDir =
       std::make_unique<AutoDelete>(createTempDir("", "nix", true, true, 0700));
@@ -112,7 +120,7 @@ Path SSHMaster::startMaster() {
                         "-S",  state->socketPath,
                         "-o",  "LocalCommand=echo started",
                         "-o",  "PermitLocalCommand=yes"};
-        // if (verbosity >= lvlChatty) args.push_back("-v");
+        // if (verbosity >= lvlChatty) { args.push_back("-v"); }
         addCommonSSHOpts(args);
         execvp(args.begin()->c_str(), stringsToCharPtrs(args).data());