comby-tools / comby

A code rewrite tool for structural search and replace that supports ~every language.
https://comby.dev
Apache License 2.0
2.4k stars 62 forks source link

Error patching cpp when -review is used #344

Open UJAM-JH opened 2 years ago

UJAM-JH commented 2 years ago

Describe the bug Comby fails on certain files if the -review option is used

Reproducing

void test() { someFunc(testA, testC, testB); }


and run this command: `DEBUG_COMBY=1 comby -review 'someFunc(:[1], :[2], :[3])' ':[1] = someOtherFunc(:[3], :[2])' comby.cpp` and then accept the change. Result:

Error attempting patch, command exited with 1. Run the command again with DEBUG_COMBY=1 set in the environment for more info. Press any key to continue, or exit now (Ctrl-C).



**Expected behavior**
It should patch after accepting the change

**Additional context**
comby 1.8.1, running on macOS.
Using the `-in-place` option works as expected
rvantonder commented 2 years ago

thanks, eyeballing, looks like -review should imply -in-place and that's not happening--will look into fixing :-)

lehmacdj commented 1 year ago

Is it possible this is a duplicate of #356?

UJAM-JH commented 1 year ago

No, the files I ran comby on did not have any spaces in the path or filename