1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 17:29:36 +01:00

Apply clang-format universally.

* It is tough to contribute to a project that doesn't use a formatter,
* It is extra hard to contribute to a project which has configured the formatter, but ignores it for some files
* Code formatting makes it harder to hide obscure / weird bugs by accident or on purpose,

Let's rip the bandaid off?

Note that PRs currently in flight should be able to be merged relatively easily by applying `clang-format` to their tip prior to merge.
This commit is contained in:
Graham Christensen 2025-07-18 12:47:27 -04:00
parent 41bf87ec70
commit e4f62e4608
587 changed files with 23258 additions and 23135 deletions

View file

@ -11,25 +11,20 @@
namespace nix {
SSHStoreConfig::SSHStoreConfig(
std::string_view scheme,
std::string_view authority,
const Params & params)
SSHStoreConfig::SSHStoreConfig(std::string_view scheme, std::string_view authority, const Params & params)
: Store::Config{params}
, RemoteStore::Config{params}
, CommonSSHStoreConfig{scheme, authority, params}
{
}
std::string SSHStoreConfig::doc()
{
return
#include "ssh-store.md"
;
#include "ssh-store.md"
;
}
struct SSHStore : virtual RemoteStore
{
using Config = SSHStoreConfig;
@ -41,8 +36,8 @@ struct SSHStore : virtual RemoteStore
, RemoteStore{*config}
, config{config}
, master(config->createSSHMaster(
// Use SSH master only if using more than 1 connection.
connections->capacity() > 1))
// Use SSH master only if using more than 1 connection.
connections->capacity() > 1))
{
}
@ -53,7 +48,9 @@ struct SSHStore : virtual RemoteStore
// FIXME extend daemon protocol, move implementation to RemoteStore
std::optional<std::string> getBuildLogExact(const StorePath & path) override
{ unsupported("getBuildLogExact"); }
{
unsupported("getBuildLogExact");
}
protected:
@ -75,8 +72,7 @@ protected:
SSHMaster master;
void setOptions(RemoteStore::Connection & conn) override
{
void setOptions(RemoteStore::Connection & conn) override {
/* TODO Add a way to explicitly ask for some options to be
forwarded. One option: A way to query the daemon for its
settings, and then a series of params to SSHStore like
@ -86,7 +82,6 @@ protected:
};
};
MountedSSHStoreConfig::MountedSSHStoreConfig(StringMap params)
: StoreConfig(params)
, RemoteStoreConfig(params)
@ -108,11 +103,10 @@ MountedSSHStoreConfig::MountedSSHStoreConfig(std::string_view scheme, std::strin
std::string MountedSSHStoreConfig::doc()
{
return
#include "mounted-ssh-store.md"
;
#include "mounted-ssh-store.md"
;
}
/**
* The mounted ssh store assumes that filesystems on the remote host are
* shared with the local host. This means that the remote nix store is
@ -183,18 +177,16 @@ struct MountedSSHStore : virtual SSHStore, virtual LocalFSStore
}
};
ref<Store> SSHStore::Config::openStore() const {
ref<Store> SSHStore::Config::openStore() const
{
return make_ref<SSHStore>(ref{shared_from_this()});
}
ref<Store> MountedSSHStore::Config::openStore() const {
return make_ref<MountedSSHStore>(ref{
std::dynamic_pointer_cast<const MountedSSHStore::Config>(shared_from_this())
});
ref<Store> MountedSSHStore::Config::openStore() const
{
return make_ref<MountedSSHStore>(ref{std::dynamic_pointer_cast<const MountedSSHStore::Config>(shared_from_this())});
}
ref<RemoteStore::Connection> SSHStore::openConnection()
{
auto conn = make_ref<Connection>();
@ -204,8 +196,7 @@ ref<RemoteStore::Connection> SSHStore::openConnection()
command.push_back("--store");
command.push_back(config->remoteStore.get());
}
command.insert(command.end(),
extraRemoteProgramArgs.begin(), extraRemoteProgramArgs.end());
command.insert(command.end(), extraRemoteProgramArgs.begin(), extraRemoteProgramArgs.end());
conn->sshConn = master.startCommand(std::move(command));
conn->to = FdSink(conn->sshConn->in.get());
conn->from = FdSource(conn->sshConn->out.get());
@ -215,4 +206,4 @@ ref<RemoteStore::Connection> SSHStore::openConnection()
static RegisterStoreImplementation<SSHStore::Config> regSSHStore;
static RegisterStoreImplementation<MountedSSHStore::Config> regMountedSSHStore;
}
} // namespace nix