fix(scoop-version): Fix logic error caused by missing brackets#6463
fix(scoop-version): Fix logic error caused by missing brackets#6463niheaven merged 3 commits intoScoopInstaller:developfrom
Conversation
4b5970e to
abbf01b
Compare
|
Please update the changelog. |
Got it. I'll update it right away. |
abbf01b to
1226860
Compare
WalkthroughAdds Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Out-of-scope changes
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
CHANGELOG.md (1)
5-8: Changelog entries look good; consider cross-linking the closed issue for traceability
- The new “scoop-version” bug-fix entry is clear and scoped. LGTM.
- Minor nit: add a reference to the closed issue (#6457) so readers can connect the symptom to the fix without opening the PR.
Apply this diff:
- - **scoop-version:** Fix logic error caused by missing brackets ([#6463](https://github.com/ScoopInstaller/Scoop/issues/6463)) + - **scoop-version:** Fix logic error caused by missing brackets (closes [#6457](https://github.com/ScoopInstaller/Scoop/issues/6457), PR [#6463](https://github.com/ScoopInstaller/Scoop/pull/6463))bin/scoop.ps1 (1)
23-24: Parentheses around get_config fix the logic bug; suggest also honoring tags at HEAD for stable output on non-master branches
- The explicit grouping prevents PowerShell from treating
-ne 'master'as an argument toget_config. This resolves the “missing brackets” bug. Good catch.- Optional improvement: if HEAD is exactly at a version tag (e.g., v0.x.y), print the release string even when
SCOOP_BRANCHis notmaster. This restores stable, parseable output for users tracking non-master but pinned to a release tag.Apply this diff to gate the commit output when not on a tag:
- if ((Test-GitAvailable) -and (Test-Path "$PSScriptRoot\..\.git") -and ((get_config SCOOP_BRANCH 'master') -ne 'master')) { + if ((Test-GitAvailable) -and (Test-Path "$PSScriptRoot\..\.git") -and ((get_config SCOOP_BRANCH 'master') -ne 'master') -and -not $tagAtHead) { Invoke-Git -Path "$PSScriptRoot\.." -ArgumentList @('--no-pager', 'log', 'HEAD', '-1', '--oneline', '--decorate')Add this snippet just above the if-condition to detect a semantic version tag at HEAD:
# Prefer stable version output if HEAD is at a semver-like tag (e.g., v0.5.3) $tagAtHead = $null if ((Test-GitAvailable) -and (Test-Path "$PSScriptRoot\..\.git")) { $tagAtHead = Invoke-Git -Path "$PSScriptRoot\.." -ArgumentList @('--no-pager', 'tag', '--points-at', 'HEAD') | Where-Object { $_ -match '^v\d+(\.\d+){1,2}$' } | Select-Object -First 1 }Rationale: Tools parsing
scoop --versionexpect a stable “vX.Y.Z - Released at YYYY-MM-DD”. If a release tag is checked out on a non-master branch, this preserves the expected format.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
CHANGELOG.md(1 hunks)bin/scoop.ps1(2 hunks)
🔇 Additional comments (1)
bin/scoop.ps1 (1)
32-37: Decorated, no-pager git logs for buckets: LGTMUsing
--no-pageravoids interactive pagers, and--decorateimproves readability without changing behavior. The added parentheses around the condition are fine.
|
I'm doubting if |
Yes, I'm afraid that it probably will. However, leaving the 'decorate' option setting on 'auto' makes the output tend to be pretty unreliable. Setting it explicitly to 'short' produces results that are consistent with what we see in the terminal, and offers a more intuitive experience. In addition, setting it to 'short' provides more information than auto in non-terminal environments, which makes it easy to fix the workflow if necessary. By the way, if most people consider it too risky, proceeding without the option |
|
Hmm, so remove |
OK. Done. |
Motivation and Context
scoop --version#6457Description
This PR makes the following changes:
Scoop/bin/scoop.ps1
Line 23 in b588a06
--no-pager: Avoid to pipe the output into less/more.See also: https://git-scm.com/docs/git/2.26.0#Documentation/git.txt--p
How Has This Been Tested?
Tested it locally with MobaXterm and WindowsTerminal.
Checklist:
developbranch.Summary by CodeRabbit
New Features
Documentation