Skip to content

fix(buckets|scoop-install): Handle cases when Git is unavailable#6591

Open
z-Fng wants to merge 1 commit intoScoopInstaller:developfrom
z-Fng:handle-git-unavailable
Open

fix(buckets|scoop-install): Handle cases when Git is unavailable#6591
z-Fng wants to merge 1 commit intoScoopInstaller:developfrom
z-Fng:handle-git-unavailable

Conversation

@z-Fng
Copy link
Member

@z-Fng z-Fng commented Jan 29, 2026

Motivation and Context

Fix two issues that occur when Git is not installed:

  1. new_issue_msg crashes when trying to invoke Git commands, leading to confusing error messages and incorrect issue links.
    e.g. [Bug] difficulty downloading 7zip #6588
    [Bug] Cannot install 7zip and git #4735
    [Bug] Scoop fails to install 7zip with error 1601 - Windows 2025 Server #6562
> Please try again or create a new issue by using the following link and paste your console output:
> https:////
  • Before:image
  • After: image
  1. Scoop update triggers a 'git required' error even when users are trying to install git itself.
  • Before: image
  • After: image

Changes:

  • lib/buckets.ps1: Check Test-GitAvailable before invoking Git in new_issue_msg.
  • libexec/scoop-install.ps1: Skip Scoop update when Git is not available.

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling when Git is unavailable on the system. The application now gracefully manages scenarios where Git cannot be accessed, preventing errors and providing appropriate fallback behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

These changes add handling for scenarios where Git is unavailable. A Test-GitAvailable check is introduced to prevent Git operations when Git is not installed or inaccessible. Updates span the changelog, bucket handling logic, and Scoop installation workflow.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added changelog entry documenting the new Git availability handling feature under the Unreleased section.
Git Availability Checks
lib/buckets.ps1, libexec/scoop-install.ps1
Added Test-GitAvailable conditions to prevent Git operations when Git is unavailable. In buckets.ps1, remote URL extraction is skipped if Git is absent. In scoop-install.ps1, the outdated Scoop warning triggers when Git is not available instead of proceeding to update.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • niheaven

Poem

🐰 When Git plays hide-and-seek,
Our buckets don't weep,
We check, we prevent, we're quite slick,
No crashes, no tricks—
Just graceful handling, chic! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding Git availability checks in buckets and scoop-install to handle cases when Git is unavailable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@29039
Copy link

29039 commented Feb 12, 2026

The "scoop install git" command works just fine. Because the main bucket is already included with scoop as a normal non-git folder, which in return contains the manifest to install git. Once the main bucket is updated after fit is installed, the main bucket also gets converted to git.

I'm not saying that is necessarily the best solution. I would prefer it if git (and 7zip) was always installed and the main bucket was synced with git in the first place.

But it's not broken by default when scoop is installed.

If your git it broken, better to reinstall scoop.

This proposed solution is pure AI slop which does nothing.

The only change I'd advocate for is for either git (and 7zip) to be installed by default, or git (and 7zip) to be installed automatically once a command requiring git is run, rather than throwing an error and having to install it manually.

@z-Fng
Copy link
Member Author

z-Fng commented Feb 12, 2026

The "scoop install git" command works just fine. Because the main bucket is already included with scoop as a normal non-git folder, which in return contains the manifest to install git. Once the main bucket is updated after fit is installed, the main bucket also gets converted to git.

This proposed solution is pure AI slop which does nothing.

I think you missed the point of what I'm actually fixing here, and it's very rude of you to call this 'AI slop' before you've even figured out what problem I'm solving.

I'm not saying that is necessarily the best solution. I would prefer it if git (and 7zip) was always installed and the main bucket was synced with git in the first place.

But it's not broken by default when scoop is installed.

If your git it broken, better to reinstall scoop.

The only change I'd advocate for is for either git (and 7zip) to be installed by default, or git (and 7zip) to be installed automatically once a command requiring git is run, rather than throwing an error and having to install it manually.

Scoop supports using external Git and 7zip installations. The assumption that 'git (and 7zip) was always installed by scoop' simply doesn't hold true for all users. Real-world scenarios are more complex than that—some errors even occur during installation, and the issue I'm addressing causes the error messages to be confusing. Reinstalling might clear the state, but it doesn't fix the logic gap that causes this confusing error in the first place.

@29039
Copy link

29039 commented Feb 13, 2026

My apologies, I completely misunderstood what you were trying to achieve, and for my tone.

I thought that you were actually trying to remediate the fact that git is not installed by default and that coderabbit make a fix which didn't actually do that.

Actually you were just making some edge case error messages more user friendly.

Which is a noble goal, but why not be more ambitious to actually provide a remediation for the elephant in the room that scoop doesn't install git automatically when needed?

Just seems like extra work for the user, and doesn't seem that hard to implement.

maybe something like this?

update the Test-GitAvailable in lib/core.ps1:

function Test-GitAvailable {
    # Check if git is available
    if ([Boolean](Get-HelperPath -Helper Git)) {
        return $true
    }

    # Git not found - attempt auto-install
    warn "Git is required but not installed. Installing git..."
    & "$PSScriptRoot\..\libexec\scoop-install.ps1" 'git'

    # Check again after install
    if ([Boolean](Get-HelperPath -Helper Git)) {
        success "Git installed successfully"
        return $true
    }

    # Install failed
    return $false
}

bin/scoop.ps1 lines 23 & 34 replace:

Test-GitAvailable

with

([Boolean](Get-HelperPath -Helper Git))

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.

2 participants