fix(3p/nix): revert "apply all clang-tidy fixes"

This reverts commit ef54f5da9f.

Resolved conflicts:
	third_party/nix/src/libexpr/eval.cc
	third_party/nix/src/libstore/builtins/fetchurl.cc
	third_party/nix/src/libstore/references.cc
	third_party/nix/src/libutil/hash.cc
	third_party/nix/src/nix-daemon/nix-daemon.cc

Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Kane York 2020-08-01 15:32:00 -07:00 committed by kanepyork
parent cc3c45f739
commit 72fc2fd27e
64 changed files with 479 additions and 555 deletions

View file

@ -30,9 +30,8 @@ std::regex revRegex("^[0-9a-fA-F]{40}$");
GitInfo exportGit(ref<Store> store, const std::string& uri,
std::optional<std::string> ref, std::string rev,
const std::string& name) {
if (evalSettings.pureEval && rev == "") {
if (evalSettings.pureEval && rev == "")
throw Error("in pure evaluation mode, 'fetchGit' requires a Git revision");
}
if (!ref && rev == "" && absl::StartsWith(uri, "/") &&
pathExists(uri + "/.git")) {
@ -91,9 +90,8 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
ref = "HEAD"s;
}
if (rev != "" && !std::regex_match(rev, revRegex)) {
if (rev != "" && !std::regex_match(rev, revRegex))
throw Error("invalid Git revision '%s'", rev);
}
deletePath(getCacheDir() + "/nix/git");
@ -106,13 +104,12 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
}
Path localRefFile;
if (ref->compare(0, 5, "refs/") == 0) {
if (ref->compare(0, 5, "refs/") == 0)
localRefFile = cacheDir + "/" + *ref;
} else {
else
localRefFile = cacheDir + "/refs/heads/" + *ref;
}
bool doFetch = 0;
bool doFetch;
time_t now = time(0);
/* If a rev was specified, we need to fetch if it's not in the
repo. */
@ -130,10 +127,9 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
} else {
/* If the local ref is older than tarball-ttl seconds, do a
git fetch to update the local ref to the remote ref. */
struct stat st {};
struct stat st;
doFetch = stat(localRefFile.c_str(), &st) != 0 ||
static_cast<uint64_t>(st.st_mtime) + settings.tarballTtl <=
static_cast<uint64_t>(now);
(uint64_t)st.st_mtime + settings.tarballTtl <= (uint64_t)now;
}
if (doFetch) {
DLOG(INFO) << "fetching Git repository '" << uri << "'";
@ -229,24 +225,22 @@ static void prim_fetchGit(EvalState& state, const Pos& pos, Value** args,
for (auto& attr_iter : *args[0]->attrs) {
auto& attr = attr_iter.second;
std::string n(attr.name);
if (n == "url") {
if (n == "url")
url =
state.coerceToString(*attr.pos, *attr.value, context, false, false);
} else if (n == "ref") {
else if (n == "ref")
ref = state.forceStringNoCtx(*attr.value, *attr.pos);
} else if (n == "rev") {
else if (n == "rev")
rev = state.forceStringNoCtx(*attr.value, *attr.pos);
} else if (n == "name") {
else if (n == "name")
name = state.forceStringNoCtx(*attr.value, *attr.pos);
} else {
else
throw EvalError("unsupported argument '%s' to 'fetchGit', at %s",
attr.name, *attr.pos);
}
}
if (url.empty()) {
if (url.empty())
throw EvalError(format("'url' argument required, at %1%") % pos);
}
} else {
url = state.coerceToString(pos, *args[0], context, false, false);