hive-forge: defer repo resolution to the accessor, not construction
This commit is contained in:
parent
cc2503d9c7
commit
fe7bf81d4a
14 changed files with 57 additions and 35 deletions
|
|
@ -229,8 +229,17 @@ fn run() -> Result<()> {
|
|||
// from a transient flake; this turns "EOF while parsing a value at
|
||||
// line 1 column 0" into "repo typo-org/repo: EOF while parsing a
|
||||
// value at line 1 column 0", which is diagnosable on sight.
|
||||
let repo = client.repo().to_owned();
|
||||
dispatch(&client, verb).with_context(|| format!("repo {repo}"))
|
||||
//
|
||||
// `client.repo()` is fallible now (a repo-independent verb like
|
||||
// `repo-search` may have none at all) — this wrapper must not
|
||||
// become the thing that revives the eager-bail bug one frame down,
|
||||
// so an unresolved repo just means no context is attached, not a
|
||||
// failure. A verb that actually needs a repo still fails, from
|
||||
// wherever it calls `client.repo()`/`client.owner_repo()` itself.
|
||||
match client.repo().ok().map(str::to_owned) {
|
||||
Some(repo) => dispatch(&client, verb).with_context(|| format!("repo {repo}")),
|
||||
None => dispatch(&client, verb),
|
||||
}
|
||||
}
|
||||
|
||||
fn dispatch(client: &client::Client, verb: Verb) -> Result<()> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue