Skip to content

Conversation

z-Fng
Copy link

@z-Fng z-Fng commented Aug 20, 2025

Motivation and Context

Description

This PR makes the following changes:

How Has This Been Tested?

Tested it locally with MobaXterm and WindowsTerminal.

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

  • New Features

    • Improved version and bucket listing outputs: commit lines now include decorations and are shown without paging for clearer, immediate context.
  • Documentation

    • CHANGELOG formatting updated for consistent label styling; no content or behavior changes.

@z-Fng z-Fng changed the title fix(scoop-version): Fix logic error caused by missing brackets, enhance compatibility of the output fix(scoop): Fix logic error caused by missing brackets, enhance compatibility for the version output Aug 22, 2025
@z-Fng z-Fng changed the title fix(scoop): Fix logic error caused by missing brackets, enhance compatibility for the version output fix(scoop): Fix logic error caused by missing brackets, improve compatibility for the version output Aug 22, 2025
@z-Fng z-Fng changed the title fix(scoop): Fix logic error caused by missing brackets, improve compatibility for the version output fix(scoop): Fix logic error caused by missing brackets, improve the version output for better compatibility Aug 22, 2025
@z-Fng z-Fng changed the title fix(scoop): Fix logic error caused by missing brackets, improve the version output for better compatibility fix(scoop): Fix logic error caused by missing brackets, improve version output for better compatibility Aug 22, 2025
@z-Fng z-Fng force-pushed the fix-scoop-version branch 2 times, most recently from 4b5970e to abbf01b Compare August 24, 2025 00:35
@niheaven
Copy link
Member

Please update the changelog.

@z-Fng
Copy link
Author

z-Fng commented Aug 26, 2025

Please update the changelog.

Got it. I'll update it right away.

@z-Fng z-Fng force-pushed the fix-scoop-version branch from abbf01b to 1226860 Compare August 26, 2025 06:46
Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds --no-pager to git log invocations and wraps existing condition tests in explicit parentheses in bin/scoop.ps1; minor punctuation/label formatting edits in CHANGELOG.md. No exported/public API changes.

Changes

Cohort / File(s) Summary
Documentation formatting
CHANGELOG.md
Adjusted bold-label punctuation and added a new bullet; content unchanged.
CLI git log invocation
bin/scoop.ps1
Added --no-pager to git log calls for version and per-bucket listings; conditional tests wrapped in extra parentheses only; control flow unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Consistent, clean version output for scoop --version showing official release tag/date when applicable (#6457) Changes only add paging flags and parentheses; they do not alter logic to prefer tag-based or changelog-derived release formatting.

Out-of-scope changes

Code Change Explanation
CHANGELOG.md punctuation/label edits (CHANGELOG.md) Formatting-only edit to changelog labels; unrelated to resolving version output formatting/logic required by the linked issue.
Added --no-pager to git log calls (bin/scoop.ps1, lines modifying git log invocations) Paging change affects output delivery but does not implement tag-based version resolution or change version string extraction logic requested by the issue.

Poem

I nibble at commits with twitching nose,
No pager now where the quick output flows.
A hop, a squeak, a decorated line—
Small changes shine beneath moonshine.
I burrow, I grin, the logs feel light and fine.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1baed1f and f1e1b22.

📒 Files selected for processing (1)
  • bin/scoop.ps1 (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bin/scoop.ps1
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 to get_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_BRANCH is not master. 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 --version expect 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.

📥 Commits

Reviewing files that changed from the base of the PR and between ff38652 and 1baed1f.

📒 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: LGTM

Using --no-pager avoids interactive pagers, and --decorate improves readability without changing behavior. The added parentheses around the condition are fine.

niheaven
niheaven previously approved these changes Aug 26, 2025
@niheaven niheaven changed the title fix(scoop): Fix logic error caused by missing brackets, improve version output for better compatibility fix(scoop-version): Fix logic error caused by missing brackets Aug 26, 2025
@niheaven
Copy link
Member

I'm doubting if --decorate will destroy someone else's workflow.

@z-Fng
Copy link
Author

z-Fng commented Aug 26, 2025

https://git-scm.com/docs/git-log#Documentation/git-log.txt---decorateshortfullautono

short: the ref name prefixes refs/heads/, refs/tags/ and refs/remotes/ are not printed.
full: the full ref name (including prefix) is printed.
auto: if the output is going to a terminal, the ref names are shown as if short were given, otherwise no ref names are shown.

The option --decorate is short-hand for --decorate=short. Default to configuration value of log.decorate if configured, otherwise, auto.

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 --decorate remains acceptable.

@niheaven
Copy link
Member

Hmm, so remove --decorate for this PR?

@z-Fng
Copy link
Author

z-Fng commented Aug 27, 2025

Hmm, so remove --decorate for this PR?

OK. Done.

@niheaven niheaven merged commit 04b7ce7 into ScoopInstaller:develop Aug 27, 2025
3 checks passed
@z-Fng z-Fng deleted the fix-scoop-version branch August 27, 2025 09:48
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