feat(freeze): no authors in the config, no author check
A repository that takes commits from people it cannot list has no way to freeze a range today: a null `authors` falls back to `git config user.email`, so every foreign author or committer fails. Null, or no key, now means neither is checked; the freeze warns that it did not check them and records `authors` as null. A list is checked as before. An empty list, which no commit could pass, is a config error that points at null. Released as 1.1.0.
This commit is contained in:
parent
0d3d8ed2d2
commit
c6b4d78245
10 changed files with 52 additions and 49 deletions
|
|
@ -233,12 +233,11 @@ int main() {
|
|||
&& ex.at("modes").at("commits").at("lenses").size() == 5 && ex.at("modes").at("series").at("lenses").size() == 10 && ex.at("modes").at("reply").at("lenses").size() == 5
|
||||
&& ex.at("modes").at("commits").at("effort") == "xhigh" && ex.at("modes").at("series").at("effort") == "max" && ex.at("modes").at("reply").at("effort") == "max"
|
||||
&& std::ranges::none_of(ex.at("lenses"), [](const Json& entry) { return entry.contains("run"); }), Show(Config::Validate(ex)));
|
||||
const fs::path repo = td / "r";
|
||||
fs::create_directories(repo);
|
||||
Process::Run({"git", "-C", repo.string(), "init", "-q"});
|
||||
Process::Run({"git", "-C", repo.string(), "config", "user.email", "me@example.com"});
|
||||
Check("authors: the configured list, else git config user.email", Config::Authors({{"authors", {"a@b.c"}}}, repo) == std::vector<std::string>{"a@b.c"}
|
||||
&& Config::Authors({{"authors", nullptr}}, repo) == std::vector<std::string>{"me@example.com"});
|
||||
Check("authors: the configured list; null or no key - none, the freeze checks neither author nor committer (2026-11-02, not the git identity)",
|
||||
Config::Authors({{"authors", {"a@b.c"}}}) == std::vector<std::string>{"a@b.c"} && !Config::Authors({{"authors", nullptr}}) && !Config::Authors(Json::object())
|
||||
&& !Config::Authors(Config::Defaults()));
|
||||
problems = bad({{"authors", Json::array()}});
|
||||
Check("an empty authors list is the problem that says null turns the check off", problems.size() == 1 && problems[0].contains("empty list") && problems[0].contains("null"), Show(problems));
|
||||
std::ofstream(td / "u.json", std::ios::binary) << "{}";
|
||||
Check("login_fixture: the first candidate that exists", Config::LoginFixture({{"functional", {{"login", {{"fixtures", {"nope.json", "u.json"}}}}}}}, td) == "u.json"
|
||||
&& !Config::LoginFixture({{"functional", {{"login", {{"fixtures", Json::array()}}}}}}, td));
|
||||
|
|
|
|||
|
|
@ -79,14 +79,18 @@ int main() {
|
|||
if (options.date.empty()) options.date = "2026-10-31";
|
||||
return Freeze::Run(repo, out, options);
|
||||
};
|
||||
Json r = freeze({.base = base});
|
||||
Json r = freeze({.base = base, .authors = std::vector<std::string> {me}});
|
||||
std::string failures = Joined(r.at("failures"));
|
||||
Check("trailer (forbid) + foreign author both named, nothing exported; the author list came from git config", !r.at("ok").get<bool>() && failures.contains("Co-Authored-By")
|
||||
Check("trailer (forbid) + foreign author both named, nothing exported", !r.at("ok").get<bool>() && failures.contains("Co-Authored-By")
|
||||
&& failures.contains("catbot@bot.local") && !fs::exists(out) && r.at("authors") == Json::array({me}), failures);
|
||||
r = freeze({.base = base, .aiTrailers = "allow"});
|
||||
r = freeze({.base = base, .authors = std::vector<std::string> {me}, .aiTrailers = "allow"});
|
||||
Check("trailer (allow): a warning, the foreign author still fails", !r.at("ok").get<bool>() && Joined(r.at("failures")).contains("catbot")
|
||||
&& !Joined(r.at("failures")).contains("Co-Authored-By") && AnyContains(r.at("warnings"), "Co-Authored-By"));
|
||||
r = freeze({.base = base, .authors = {me, "catbot@bot.local"}, .aiTrailers = "allow"});
|
||||
r = freeze({.base = base});
|
||||
Check("no authors (null in the config): author and committer unchecked, said in a warning - only the trailer fails", !r.at("ok").get<bool>()
|
||||
&& Joined(r.at("failures")).contains("Co-Authored-By") && !Joined(r.at("failures")).contains("catbot") && r.at("authors").is_null()
|
||||
&& AnyContains(r.at("warnings"), "author and committer not checked"), Joined(r.at("failures")));
|
||||
r = freeze({.base = base, .authors = std::vector<std::string> {me, "catbot@bot.local"}, .aiTrailers = "allow"});
|
||||
Check("both emails in authors + allow -> the range freezes (3 commits)", r.at("ok").get<bool>() && r.at("files").size() == 3, Joined(r.at("failures")));
|
||||
g({"reset", "-q", "--hard", clean});
|
||||
r = freeze({.base = base, .replace = true});
|
||||
|
|
|
|||
Loading…
Reference in a new issue