Skip to content

edit: auto-tap core/cask repos when not installed#21641

Merged
MikeMcQuaid merged 5 commits intoHomebrew:mainfrom
tiluckdave:fix/brew-edit-auto-tap-21585
Mar 1, 2026
Merged

edit: auto-tap core/cask repos when not installed#21641
MikeMcQuaid merged 5 commits intoHomebrew:mainfrom
tiluckdave:fix/brew-edit-auto-tap-21585

Conversation

@tiluckdave
Copy link
Contributor

  • 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?
  • Have you written new 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. Cursor was used to navigate and understand the codebase. It also helped with the code. Bug analysis, fix design, and testing were done manually.

Fixes #21585.

brew edit auto-enables developer mode but doesn't clone the taps, leaving users with a misleading brew create error. This fix adds auto-tap before to_paths in edit.rb when the formula/cask is API-known, but the tap isn't installed.

Verified end-to-end with brew edit --print-path wget on an install without taps.

Copilot AI review requested due to automatic review settings February 28, 2026 14:04
Copy link
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

Adjusts brew edit to automatically tap homebrew/core or homebrew/cask when a requested formula/cask is known via the API but the corresponding tap isn’t installed, preventing misleading “doesn’t exist on disk” errors after developer mode is auto-enabled.

Changes:

  • Auto-install homebrew/core / homebrew/cask (with --force) before resolving named args to paths in dev-cmd/edit.
  • Add an edit command spec covering auto-tapping core for an API-known formula when core isn’t installed.
  • Add a NamedArgs#to_paths spec documenting the without_api: true behavior that motivates the edit workaround.

Reviewed changes

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

File Description
Library/Homebrew/dev-cmd/edit.rb Auto-tap core/cask before to_paths when the item is API-known but the tap isn’t installed.
Library/Homebrew/test/dev-cmd/edit_spec.rb Adds a regression test for auto-tapping homebrew/core during brew edit.
Library/Homebrew/test/cli/named_args_spec.rb Adds a spec documenting to_paths behavior under without_api: true when core isn’t installed.

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

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks, looks good so far, a few comments.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

More thoughts, sorry!

@tiluckdave tiluckdave requested a review from MikeMcQuaid March 1, 2026 06:36
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks @tiluckdave!

@MikeMcQuaid MikeMcQuaid enabled auto-merge March 1, 2026 13:13
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Mar 1, 2026
Merged via the queue into Homebrew:main with commit dd3e642 Mar 1, 2026
36 checks passed
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.

brew edit with developer mode off triggers it, don't tap main repos and breaks future edits

3 participants