Skip to content

Simplify latesttag branch with early return, drop lifetime workaround#93

Merged
redpanda-f merged 2 commits intofeat/redpanda/latesttag-resolverfrom
copilot/sub-pr-83-another-one
Mar 11, 2026
Merged

Simplify latesttag branch with early return, drop lifetime workaround#93
redpanda-f merged 2 commits intofeat/redpanda/latesttag-resolverfrom
copilot/sub-pr-83-another-one

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

The latesttag special case in canonicalize_location used a pre-declared resolved_tag variable (with a "must outlive the match below" comment) to work around borrow lifetimes — unnecessary since there's no match after it, just a direct Ok(...) return.

Changes

  • Early return in latesttag branch: replaces mutation of selector/location_type with a direct return Ok(("gittag".into(), url.into(), tag))
  • Drop mut: location_type and selector no longer need to be mutable
// Before
let resolved_tag; // must outlive the match below
if location_type == "latesttag" {
    resolved_tag = Self::resolve_latest_tag(url, selector)?;
    selector = resolved_tag.as_str();
    location_type = "gittag";
}
Ok((location_type.into(), url.into(), selector.into()))

// After
if location_type == "latesttag" {
    let tag = Self::resolve_latest_tag(url, selector)?;
    return Ok(("gittag".into(), url.into(), tag));
}
Ok((location_type.into(), url.into(), selector.into()))

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Copilot AI changed the title [WIP] Update latesttag location resolver based on feedback Simplify latesttag branch with early return, drop lifetime workaround Mar 11, 2026
@redpanda-f redpanda-f marked this pull request as ready for review March 11, 2026 13:22
@redpanda-f redpanda-f merged commit 535fa10 into feat/redpanda/latesttag-resolver Mar 11, 2026
@redpanda-f redpanda-f deleted the copilot/sub-pr-83-another-one branch March 11, 2026 13:23
redpanda-f added a commit that referenced this pull request Mar 13, 2026
* feat: add LatestTag location resolver for init-time tag discovery

* makehappy: fmt

* Update src/commands/init/latest_resolver.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/commands/init/repositories.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/config.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/config.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactor: decompose `fetch_latest_tag` into focused helpers with module-level constant (#85)

* Initial plan

* refactor: decompose fetch_latest_tag into focused helpers with module-level constant

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

* fix: remove usage of deprecated methods

* fix: new resolver

* fixup: latesttag

* fixup: clippy issues

* Update src/config.rs

Co-authored-by: Rod Vagg <rod@vagg.org>

* Rename `_type` to `loc_type` in `resolve_with_default` (#91)

* Initial plan

* rename _type to loc_type in resolve_with_default

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

* Simplify `latesttag` branch with early return, drop lifetime workaround (#93)

* Initial plan

* Simplify latesttag handling with early return, drop lifetimes dance

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

* Fix invalid `v/*` glob example — replace with `v*` throughout (#92)

* Initial plan

* Replace invalid v/* glob pattern with v* in docs and code

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Co-authored-by: Rod Vagg <rod@vagg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants