Skip to content

Conversation

@cho-m
Copy link
Member

@cho-m cho-m commented Nov 11, 2025

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Updates my previous change to avoid multiple hardcoded 7 values in code and instead use a constant.

Copilot AI review requested due to automatic review settings November 11, 2025 19:16
Copilot finished reviewing on behalf of cho-m November 11, 2025 19:18
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

This PR refactors hardcoded commit hash length values by introducing a constant MINIMUM_COMMIT_HASH_LENGTH = 7 in the GitDownloadStrategy class. The constant is then used consistently across Git download strategies and the GitHub utility module.

  • Introduces MINIMUM_COMMIT_HASH_LENGTH constant to replace hardcoded 7 values
  • Refactors GitHub.last_commit to accept an optional length parameter
  • Simplifies GitHubGitDownloadStrategy#last_commit implementation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/download_strategy.rb Adds MINIMUM_COMMIT_HASH_LENGTH constant and refactors last_commit methods to use it
Library/Homebrew/utils/github.rb Adds optional length parameter to last_commit method and refactors conditional logic

💡 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.

Makes sense, thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 11, 2025
Merged via the queue into main with commit 08c0afe Nov 11, 2025
43 checks passed
@MikeMcQuaid MikeMcQuaid deleted the git-commit-head-cleanup branch November 11, 2025 19:59
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