Skip to content

✨ feat: prefer latest tag on current branch when resolving tags#2

Merged
AliRezaTaleghani merged 1 commit into
mainfrom
improveChangesDetection
Nov 18, 2025
Merged

✨ feat: prefer latest tag on current branch when resolving tags#2
AliRezaTaleghani merged 1 commit into
mainfrom
improveChangesDetection

Conversation

@AliRezaTaleghani

Copy link
Copy Markdown
Contributor

Improve tag discovery and commit range computation by introducing a
helper that finds the latest tag on the current branch and using it
consistently across functions.

  • Add getLatestTagOnBranch(prefix) to obtain current branch and
    run git describe --match against that branch. This
    centralizes tag lookup and trims whitespace before returning.
  • Replace ad-hoc git describe invocations in last-release lookup
    with getLatestTagOnBranch to avoid incorrect tag resolution and
    simplify error handling.
  • Use the canonical string (already trimmed by the helper) when
    trimming the prefix and when constructing git log ranges.
  • Handle empty tag results consistently (check for empty string
    instead of byte-length) and preserve fallbacks to analyzing all
    commits when no prior tag is found.

These changes make tag lookup branch-aware, reduce duplicated git
invocation logic, and prevent subtle bugs from trimming or handling
raw command output.

Improve tag discovery and commit range computation by introducing a
helper that finds the latest tag on the current branch and using it
consistently across functions.

- Add getLatestTagOnBranch(prefix) to obtain current branch and
  run git describe --match <pattern> against that branch. This
  centralizes tag lookup and trims whitespace before returning.
- Replace ad-hoc git describe invocations in last-release lookup
  with getLatestTagOnBranch to avoid incorrect tag resolution and
  simplify error handling.
- Use the canonical string (already trimmed by the helper) when
  trimming the prefix and when constructing git log ranges.
- Handle empty tag results consistently (check for empty string
  instead of byte-length) and preserve fallbacks to analyzing all
  commits when no prior tag is found.

These changes make tag lookup branch-aware, reduce duplicated git
invocation logic, and prevent subtle bugs from trimming or handling
raw command output.
@AliRezaTaleghani AliRezaTaleghani merged commit 74ec6f4 into main Nov 18, 2025
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.

1 participant