Skip to content

formula: extract commit for goreleaser flags - #24163

Merged
cho-m merged 4 commits into
mainfrom
get_tar_commit_id
Oct 5, 2026
Merged

cho-m merged 4 commits into
mainfrom
get_tar_commit_id

Conversation

@cho-m

@cho-m cho-m commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

This provides more accurate data for :goreleaser builds and the Utils::Git.get_tar_commit_id can be used by other formulae to switch from git clone to git archives (reducing disk/network IO).

For :goreleaser, now populating main.commit as follows:

  1. For stable spec from VCS, use the revision metadata as it is already available.
  2. For supported tarballs, try git get-tar-commit-id as git archive includes commit inside PAX header
  3. For everything else, try running git on buildpath ignoring failures. This is for HEAD builds.
  4. As fallback, use the tap owner placeholder. Now should be less common, but maybe if formula uses GitLab .tar.bz2 tarball

I did not use UnpackStrategy as there is a significant cost given 1kB vs MB/GB unpack time and the cost of SSD disk writes which impacts lifespan.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

n/a


cho-m added 2 commits October 4, 2026 13:53
This allows obtaining the git commit without needing to use a git clone.
It avoids using unpack_strategy which is significantly slower due to
unpacking entire tarball and extra disk writes impact hardware lifespan.
Copilot AI lite review requested due to automatic review settings October 4, 2026 18:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

馃煛 Changes recommended

Two unresolved findings remain in formula.rb, including one critical issue.

Review effort: Lite
Findings: 1 High severity 路 1 Medium severity

Open (2)
What changed in this PR

Improves GoReleaser commit metadata by extracting commits from VCS sources and Git archives.

Changes:

  • Added tarball commit extraction.
  • Updated GoReleaser commit selection and fallbacks.
  • Added utility and formula test coverage.
File Summary
Library/鈥婬omebrew/鈥媢tils/鈥媑it.rb Adds Git archive commit extraction.
Library/鈥婬omebrew/鈥媡est/鈥媢tils/鈥媑it_spec.rb Tests archive commit extraction.
Library/鈥婬omebrew/鈥媡est/鈥媐ormula_spec.rb Tests GoReleaser commit selection.
Library/鈥婬omebrew/鈥媐ormula.rb Integrates revision, archive, repository, and fallback detection. Unresolved findings: moderate (4 votes) URL-extension handling issue and critical (1 vote) unsafe Git failure handling.

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/formula.rb
Comment thread Library/Homebrew/formula.rb Outdated
@cho-m
cho-m marked this pull request as draft October 4, 2026 19:24
@cho-m

cho-m commented Oct 4, 2026 •

Copy link
Copy Markdown
Member Author

Draft until I fix the test on Linux runners.

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

Comment thread Library/Homebrew/utils/git.rb
cho-m and others added 2 commits October 4, 2026 19:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@cho-m
cho-m force-pushed the get_tar_commit_id branch from e3239b6 to 8097398 Compare October 4, 2026 23:31
@cho-m
cho-m marked this pull request as ready for review October 4, 2026 23:31
@cho-m
cho-m requested a lite review from Copilot October 4, 2026 23:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

馃數 Needs a closer look

Extend tar commit extraction to all supported archive formats or explicitly document the limitation.

Review effort: Lite
Findings: None

Resolved since last review (2)

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to self-merge when you're happy!

@cho-m
cho-m added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit ef90f72 Oct 5, 2026
52 checks passed
@cho-m
cho-m deleted the get_tar_commit_id branch October 5, 2026 14:50
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.

3 participants