Skip to content

Add boundary-aware suffix fallback for git checkout ref resolution#280

Merged
soimkim merged 1 commit into
mainfrom
ver
May 19, 2026
Merged

Add boundary-aware suffix fallback for git checkout ref resolution#280
soimkim merged 1 commit into
mainfrom
ver

Conversation

@soimkim
Copy link
Copy Markdown
Contributor

@soimkim soimkim commented May 19, 2026

Description

When exact, v-prefix, and semver matching all fail, fall back to finding refs that end with the input version string at a separator boundary (-, _, /, .). This allows e.g. input "stable202002" to match branch "edk2-stable202002" while preventing false positives like input "2" matching ref "3.02".

Summary by CodeRabbit

  • Bug Fixes
    • Improved version reference resolution with enhanced fallback matching when standard methods fail
    • Now supports case-insensitive partial matching for greater reliability in locating requested versions
    • Prioritizes most specific matches when multiple candidates qualify

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

This change extends the checkout base resolution logic with a case-insensitive partial matching fallback. When exact ref and semver-based resolution strategies fail, the code now scans available refs for suffix matches constrained by separator boundaries, selects the shortest match, and returns it with the clarified version.

Changes

Checkout Base Resolution Enhancement

Layer / File(s) Summary
Partial match fallback implementation
src/fosslight_util/download.py
Added fallback logic in _try_resolve_checkout_base() that performs case-insensitive suffix matching on refs at separator boundaries, selects the shortest match, logs it as "Partial match", and returns the matched ref with clarified version.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add boundary-aware suffix fallback for git checkout ref resolution' directly and specifically describes the main change: adding a new fallback mechanism with boundary awareness to the git checkout ref resolution logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ver

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@soimkim soimkim changed the title feat: add boundary-aware suffix fallback for git checkout ref resolution Add boundary-aware suffix fallback for git checkout ref resolution May 19, 2026
@soimkim soimkim self-assigned this May 19, 2026
@soimkim soimkim added the chore [PR/Issue] Refactoring, maintenance the code label May 19, 2026
@soimkim soimkim merged commit febb6f9 into main May 19, 2026
8 checks passed
@soimkim soimkim deleted the ver branch May 19, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore [PR/Issue] Refactoring, maintenance the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant