Skip to content

fix(but): print normalized name after branch rename#13160

Draft
slarse wants to merge 1 commit intomasterfrom
GB-1247/reword-branch-print-normalized-name
Draft

fix(but): print normalized name after branch rename#13160
slarse wants to merge 1 commit intomasterfrom
GB-1247/reword-branch-print-normalized-name

Conversation

@slarse
Copy link
Copy Markdown
Contributor

@slarse slarse commented Apr 2, 2026

but reword <branch> always did normalize the new branch name, but the original input was what was printed afterward. This made it seem like you had created an invalid branch name, whereas in reality the name was normalized.

This PR just makes the output consistent with reality.

TODO

Tests probably need revising as I realized that trailing dashes are actually fine by Git, it's just GitButler that strips them away for some reason. I think this is wrong.

Copilot AI review requested due to automatic review settings April 2, 2026 11:55
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Preview Apr 2, 2026 0:02am

Request Review

@github-actions github-actions bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Apr 2, 2026
Copy link
Copy Markdown
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 makes but reword <branch> print the actual (normalized) branch name after a rename, aligning CLI output with the underlying behavior where invalid names are automatically normalized.

Changes:

  • Update the reword command to print the normalized branch name (and explicitly indicate when normalization occurred).
  • Change but-api’s update_branch_name_with_perm to return the normalized name from the underlying branch-actions layer.
  • Add a regression test to assert the normalization message and final renamed branch output.

Reviewed changes

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

File Description
crates/but/src/command/legacy/reword.rs Prints normalized branch name after rename; adds a normalization notice line when applicable.
crates/but-api/src/legacy/stack.rs Returns String (normalized name) from update_branch_name_with_perm to enable correct CLI output.
crates/but/tests/but/command/reword.rs Adds test coverage for branch-name normalization behavior and output.

Comment thread crates/but/tests/but/command/reword.rs
Comment thread crates/but/tests/but/command/reword.rs Outdated
Comment thread crates/but-api/src/legacy/stack.rs
`but reword <branch>` always did normalize the new branch name, but the
original input was what was printed afterward. This made it seem like
you had created an invalid branch name, whereas in reality the name was
normalized.

This commit just makes the output consistent with reality.
@slarse slarse force-pushed the GB-1247/reword-branch-print-normalized-name branch from 77ade0f to ec3f250 Compare April 2, 2026 12:02
@slarse slarse marked this pull request as draft April 2, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants