Repository navigation
fix(fish): do not wrap an already wrapped script behind a leading line continuation - #5143
Open
Kernel-Hunter wants to merge 1 commit into
Open
Kernel-Hunter wants to merge 1 commit into
Kernel-Hunter wants to merge 1 commit into
Conversation
…ding line continuation try_wrap read the first word of the trimmed script, so a leading backslash and newline hid an existing rtk run --shell fish wrap and it was wrapped a second time. Read the first word after bash's line continuations are dropped, as the rewrite rules already do. Fixes rtk-ai#4923
📊 Automated PR Analysis
SummaryFixes a bug in the fish script wrapping logic where a script already delegating to Review Checklist
Linked issues: #4923 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
try_wrapdecides that a script already delegates to rtk by reading the first word of the trimmed text. Behind a leading\and newline that first word is the\, so a command that is alreadyrtk run --shell fish -c '...'gets wrapped a second time. Bash drops the continuation before running the command, so the first word is reallyrtk.collapse_line_continuations, the same helper the rewrite rules use. The result for the issue's two rows is the same: neither is wrapped.askprompt, since a settings deny still blocked the wrapped form.Test plan
test_already_wrapped_script_behind_leading_continuation_is_not_wrapped_againcovers the plain form, one continuation, and two continuations with indentation. It fails on develop and passes with this change.cargo fmt --all -- --check,cargo clippy --all-targets -- -D warningsandcargo test --lib(4699 passed) pass on macOS.Fixes #4923