Skip to content

Conversation

schacon
Copy link
Member

@schacon schacon commented Oct 17, 2025

Fix parsing of Gerrit remote push lines so status tags (e.g. [WIP], [NEW], [PRIVATE]) at the end of the line are recognized and stripped from the commit title.

The old logic only detected exactly "[NEW]" and failed to remove or recognize other tags, causing URLs and titles not to be parsed correctly when using options like %wip. This change generalizes detection of a trailing status tag, trims it safely, and adds unit tests for WIP, PRIVATE, and edge cases (titles containing brackets).

Fix parsing of Gerrit remote push lines so status tags (e.g. [WIP], [NEW], [PRIVATE]) at the end of the line are recognized and stripped from the commit title. The old logic only detected exactly "[NEW]" and failed to remove or recognize other tags, causing URLs and titles not to be parsed correctly when using options like %wip. This change generalizes detection of a trailing status tag, trims it safely, and adds unit tests for WIP, PRIVATE, and edge cases (titles containing brackets).
Copy link

vercel bot commented Oct 17, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
gitbutler-web Ignored Ignored Preview Oct 17, 2025 10:50am

@github-actions github-actions bot added the rust Pull requests that update Rust code label Oct 17, 2025
@schacon
Copy link
Member Author

schacon commented Oct 17, 2025

This doesn't seem to actually fix the WIP problem (but push with a wip flag does not associate a url with the pushed commits), but it must be somewhere around this code.

@krlvi
Copy link
Member

krlvi commented Oct 17, 2025

@schacon i got a working fix here #10708

Btw - completely meta, the prompts are not version controlled, but i was able to one-shot instruct claude to fix this with the following prompt:

The parse module of the but-gerrit crate handles the text output when pushing to a gerrit server. It parses the output into a structure. However it seems like this does not correctly in the case when the push includes the %wip option.
Heres and example output that needs to be parsed:
"remote: \rremote: Processing changes: refs: 1, new: 1 \rremote: Processing changes: refs: 1, new: 1 \rremote: Processing changes: refs: 1, new: 1 \rremote: Processing changes: refs: 1, new: 1, done \nremote: \nremote: SUCCESS \nremote: \nremote:
http://15a45d4cba1a/c/gerrit-test/+/47
 hello [WIP] [NEW] \nremote:"

Please add handling for this as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants