Skip to content

pkg: replace installer git dir#22090

Merged
MikeMcQuaid merged 1 commit intomainfrom
pkg-replace-git-dir
Apr 26, 2026
Merged

pkg: replace installer git dir#22090
MikeMcQuaid merged 1 commit intomainfrom
pkg-replace-git-dir

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

  • replace the staged .git atomically before privileged Git runs
  • avoid merging into an existing .git during Intel reinstalls
  • keep a clean packaged Git directory in .git.pkg

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex xhigh with local review and testing.


Copilot AI review requested due to automatic review settings April 25, 2026 18:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the macOS installer packaging flow to keep a pristine packaged Git directory in .git.pkg and then replace the installed .git directory via renames before running privileged Git commands, including during Intel /usr/local reinstalls.

Changes:

  • Add cleanup of ${homebrew_directory}/.git.pkg in preinstall.
  • Replace .git using .git.pkg (with a .git.previous staging dir) in postinstall, and switch Intel /usr/local/Homebrew handling from copy to rename-based replacement.
  • Update the release workflow to include a .git.pkg directory in the pkg payload by copying brew/.git.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
package/scripts/preinstall Removes any existing .git.pkg before payload install to avoid directory merges.
package/scripts/postinstall Replaces .git from .git.pkg and updates Intel reinstall behavior to avoid merging into an existing .git.
.github/workflows/release.yml Adds creation of brew/.git.pkg during release packaging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package/scripts/postinstall Outdated
Comment thread package/scripts/postinstall Outdated
Comment thread package/scripts/postinstall Outdated
Comment thread .github/workflows/release.yml Outdated
Copy link
Copy Markdown
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

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

this will reset analytics settings etc so might want to restore those

@MikeMcQuaid MikeMcQuaid marked this pull request as draft April 25, 2026 19:18
@MikeMcQuaid MikeMcQuaid force-pushed the pkg-replace-git-dir branch from aa52770 to 792d24f Compare April 26, 2026 11:37
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review April 26, 2026 11:39
- clear `.git/hooks` before privileged installer `git` operations
- run repository `git` calls through `git_no_hooks` to ignore
  `core.hooksPath`
- fail `release.yml` if future installer `git` calls skip that
  wrapper
@MikeMcQuaid MikeMcQuaid force-pushed the pkg-replace-git-dir branch from 792d24f to d7ac00a Compare April 26, 2026 11:44
@MikeMcQuaid MikeMcQuaid enabled auto-merge April 26, 2026 11:44
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 26, 2026
Merged via the queue into main with commit cc07540 Apr 26, 2026
41 checks passed
@MikeMcQuaid MikeMcQuaid deleted the pkg-replace-git-dir branch April 26, 2026 12:17
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