mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 23:42:43 +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:
parent
41bf87ec70
commit
e4f62e4608
587 changed files with 23258 additions and 23135 deletions
|
|
@ -13,12 +13,10 @@ LocalFSStoreConfig::LocalFSStoreConfig(PathView rootDir, const Params & params)
|
|||
// Default `?root` from `rootDir` if non set
|
||||
// FIXME don't duplicate description once we don't have root setting
|
||||
, rootDir{
|
||||
this,
|
||||
!rootDir.empty() && params.count("root") == 0
|
||||
? (std::optional<Path>{rootDir})
|
||||
: std::nullopt,
|
||||
"root",
|
||||
"Directory prefixed to all other paths."}
|
||||
this,
|
||||
!rootDir.empty() && params.count("root") == 0 ? (std::optional<Path>{rootDir}) : std::nullopt,
|
||||
"root",
|
||||
"Directory prefixed to all other paths."}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +38,6 @@ struct LocalStoreAccessor : PosixSourceAccessor
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
void requireStoreObject(const CanonPath & path)
|
||||
{
|
||||
auto [storePath, rest] = store->toStorePath(store->storeDir + path.abs());
|
||||
|
|
@ -53,7 +50,7 @@ struct LocalStoreAccessor : PosixSourceAccessor
|
|||
/* Also allow `path` to point to the entire store, which is
|
||||
needed for resolving symlinks. */
|
||||
if (path.isRoot())
|
||||
return Stat{ .type = tDirectory };
|
||||
return Stat{.type = tDirectory};
|
||||
|
||||
requireStoreObject(path);
|
||||
return PosixSourceAccessor::maybeLstat(path);
|
||||
|
|
@ -65,10 +62,7 @@ struct LocalStoreAccessor : PosixSourceAccessor
|
|||
return PosixSourceAccessor::readDirectory(path);
|
||||
}
|
||||
|
||||
void readFile(
|
||||
const CanonPath & path,
|
||||
Sink & sink,
|
||||
std::function<void(uint64_t)> sizeCallback) override
|
||||
void readFile(const CanonPath & path, Sink & sink, std::function<void(uint64_t)> sizeCallback) override
|
||||
{
|
||||
requireStoreObject(path);
|
||||
return PosixSourceAccessor::readFile(path, sink, sizeCallback);
|
||||
|
|
@ -83,9 +77,8 @@ struct LocalStoreAccessor : PosixSourceAccessor
|
|||
|
||||
ref<SourceAccessor> LocalFSStore::getFSAccessor(bool requireValidPath)
|
||||
{
|
||||
return make_ref<LocalStoreAccessor>(ref<LocalFSStore>(
|
||||
std::dynamic_pointer_cast<LocalFSStore>(shared_from_this())),
|
||||
requireValidPath);
|
||||
return make_ref<LocalStoreAccessor>(
|
||||
ref<LocalFSStore>(std::dynamic_pointer_cast<LocalFSStore>(shared_from_this())), requireValidPath);
|
||||
}
|
||||
|
||||
void LocalFSStore::narFromPath(const StorePath & path, Sink & sink)
|
||||
|
|
@ -104,9 +97,8 @@ std::optional<std::string> LocalFSStore::getBuildLogExact(const StorePath & path
|
|||
for (int j = 0; j < 2; j++) {
|
||||
|
||||
Path logPath =
|
||||
j == 0
|
||||
? fmt("%s/%s/%s/%s", config.logDir.get(), drvsLogDir, baseName.substr(0, 2), baseName.substr(2))
|
||||
: fmt("%s/%s/%s", config.logDir.get(), drvsLogDir, baseName);
|
||||
j == 0 ? fmt("%s/%s/%s/%s", config.logDir.get(), drvsLogDir, baseName.substr(0, 2), baseName.substr(2))
|
||||
: fmt("%s/%s/%s", config.logDir.get(), drvsLogDir, baseName);
|
||||
Path logBz2Path = logPath + ".bz2";
|
||||
|
||||
if (pathExists(logPath))
|
||||
|
|
@ -115,12 +107,12 @@ std::optional<std::string> LocalFSStore::getBuildLogExact(const StorePath & path
|
|||
else if (pathExists(logBz2Path)) {
|
||||
try {
|
||||
return decompress("bzip2", readFile(logBz2Path));
|
||||
} catch (Error &) { }
|
||||
} catch (Error &) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue