Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

Commit

update_repo's description changes the repository's project again (#52): since descriptions became the project's (#45), update_repo still listed description and passed it to the repos service, which no longer takes it, so a description given there was dropped without a word. It now sets the repository's own project's description through the projects service's describe, as create_repo already does and as update_project would, after the repository's other fields change; "" clears it, it needs the Maintain role like update_project, and a refusal from projects is the answer. Its schema, the operation's description, the MCP repository tool's update action, the reference notes and Managing a repository say so; the OpenAPI copy is regenerated.

Checked:
cargo test -p g1t-api (208, with and without G1T_WRITE_OPENAPI), cargo test -p g1t ops_table.
G1t-Session:
ses_01m4ynr1peevvs8zwaqakycv2e
syntaqxcommitted Parent2e90f6fBrowse files
5 files+24−60/5 viewed
+19−3
15331533 Op::ListRepos => "Repositories you can see, optionally filtered by a search query.",
15341534 Op::GetRepo => "One repository's details.",
15351535 Op::UpdateRepo => {
1536− "Change a repository's website, topics and default branch, whether its default branch is protected, whether it is private, whether a private repository may be forked, and the most branches and tags one push may change (max_ref_updates). Only the fields given are changed. Its website and topics need the Maintain role or higher; protecting its default branch, making it public or private, allowing forking, max_ref_updates and changing its default branch need the Admin role (and making it public or private, the workspace's member privileges to allow it, unless you are an owner), and a free workspace takes a private repository only while its private storage has room. A protected branch refuses pushes and changes only by merging a pull request. A new default branch must already exist; open pull requests then merge into it. A fork cannot be made public or private: it is as visible as its parent until it is detached (detach_fork). A repository has no description: its project has, changed with update_project."
1536+ "Change a repository's website, topics and default branch, whether its default branch is protected, whether it is private, whether a private repository may be forked, and the most branches and tags one push may change (max_ref_updates). Only the fields given are changed. Its website and topics need the Maintain role or higher; protecting its default branch, making it public or private, allowing forking, max_ref_updates and changing its default branch need the Admin role (and making it public or private, the workspace's member privileges to allow it, unless you are an owner), and a free workspace takes a private repository only while its private storage has room. A protected branch refuses pushes and changes only by merging a pull request. A new default branch must already exist; open pull requests then merge into it. A fork cannot be made public or private: it is as visible as its parent until it is detached (detach_fork). A repository has no description of its own: description changes its project's, as update_project does, and needs the Maintain role or higher."
15371537 }
15381538 Op::RenameRepo => {
15391539 "Give a repository a new name in its workspace. Needs the Admin role. Everything stays with it: git data, issues, pull requests, workflow runs, deployments, secrets and webhooks. Its old address keeps working: web pages, git remotes and API calls redirect to the new one until a repository is made at the old address. The new name must be free in the workspace, including names held by recently deleted repositories."
23702370 Op::UpdateRepo => object(
23712371 json!({
23722372 "repo": repo_schema(),
2373− "description": { "type": "string", "description": "An empty string clears it." },
2373+ "description": { "type": "string", "description": "What it is, in a line: the description of its project, as update_project sets it. A repository has none of its own. An empty string clears it." },
23742374 "private": { "type": "boolean" },
23752375 "protected": {
23762376 "type": "boolean",
45884588 &json!({
45894589 "actor": actor(),
45904590 "path": repo,
4591− "description": input["description"].as_str(),
45924591 "isPrivate": input["private"].as_bool(),
45934592 "protected": input["protected"].as_bool(),
45944593 "topics": strings(input, "topics"),
45994598 }),
46004599 )
46014600 .await?;
4601+ // A repository has no description: the one given is its
4602+ // project's, changed as update_project changes it ("" clears it).
4603+ let updated = match (updated, input["description"].as_str()) {
4604+ (Outcome::Ok(changed), Some(description)) => {
4605+ let described: Outcome<Value> = call(
4606+ &services.projects,
4607+ "describe",
4608+ &json!({ "actor": actor(), "repoId": changed["id"], "description": description }),
4609+ )
4610+ .await?;
4611+ match described {
4612+ Outcome::Ok(_) => Outcome::Ok(changed),
4613+ Outcome::Fail(failure) => Outcome::Fail(failure),
4614+ }
4615+ }
4616+ (updated, _) => updated,
4617+ };
46024618 // A new default branch, once the rest has been changed.
46034619 match (&updated, optional_text(input, "default_branch")) {
46044620 (Outcome::Ok(_), Some(branch)) => {
+1−1
702702 "website": "https://hello.g1t.page",
703703 "archived_at": null
704704 },
705− "notes": "Only the fields given change. `website` gets `https://` when no scheme is given; an empty string clears it. `default_branch` must name a branch that exists (`422` otherwise); it is changed after the other fields. `description`, `website`, `topics` and `protected` need the Maintain role or higher, and `private`, `allow_forking`, `max_ref_updates` and `default_branch` the Admin role (`403` otherwise, saying which role). Changing `private` here needs no confirmation; `POST /repos/{owner}/{name}/visibility` asks for one. Making it private is refused with `402` when a free workspace's private storage has no room for it. A fork cannot change `private` (`422`): detach it first. See [Managing a repository](/guides/managing-repositories/) and [Access and roles](/guides/access-and-roles/)."
705+ "notes": "Only the fields given change. A repository has no description of its own: `description` changes its project's, as [`update_project`](/reference/api/projects/update-project/) does; an empty string clears it. `website` gets `https://` when no scheme is given; an empty string clears it. `default_branch` must name a branch that exists (`422` otherwise); it is changed after the other fields. `description`, `website`, `topics` and `protected` need the Maintain role or higher, and `private`, `allow_forking`, `max_ref_updates` and `default_branch` the Admin role (`403` otherwise, saying which role). Changing `private` here needs no confirmation; `POST /repos/{owner}/{name}/visibility` asks for one. Making it private is refused with `402` when a free workspace's private storage has no room for it. A fork cannot change `private` (`422`): detach it first. See [Managing a repository](/guides/managing-repositories/) and [Access and roles](/guides/access-and-roles/)."
706706 },
707707 "transfer_repo": {
708708 "request": {
+1−1
8686 a("tarball", Op::Archives(ArchiveOp::DownloadTarball), "A 10-minute link to a branch, tag or commit as a .tar.gz"),
8787 a("zipball", Op::Archives(ArchiveOp::DownloadZipball), "A 10-minute link to a branch, tag or commit as a .zip"),
8888 a("create", Op::CreateRepo, "Create one, empty or copied from a public git URL"),
89− a("update", Op::UpdateRepo, "Change website, topics, default branch, protection, forking"),
89+ a("update", Op::UpdateRepo, "Change description (its project's), website, topics, default branch, protection, forking"),
9090 a("get_settings", Op::GetRepoSettings, "How pull requests merge, and the default branch's protection as its rules stack"),
9191 a("update_settings", Op::UpdateRepoSettings, "Change how pull requests merge and the default branch protection ruleset"),
9292 a("check_names", Op::ListCheckNames, "Check names reported lately, to require in a ruleset"),
+3−1
2121 [project](/guides/projects/) has, and search, link previews and lists of
2222 repositories show that one. Change it in the project's **Settings →
2323 General**, or with
24−[`update_project`](/reference/api/projects/update-project/).
24+[`update_project`](/reference/api/projects/update-project/) (or
25+`description` on [`update_repo`](/reference/api/repositories/update-repo/),
26+which changes the same one).
2527
2628 The **Code** page shows its files with its facts beside them. On a phone
2729 they come after the files.
+0−0

Binary or large file; its contents are not shown.

Comments

Sign in to comment.