Error applying hunk
When trying to commit changes to a virtual branch, I got an error that it is not possible to do so. When restarting GitButler, I get "Error: Something went wrong" Looking into the logs, I see: 0: failed to list virtual branches 1: failed to apply (...here some git diff code...) 2: error applying hunk 20
Is there some way to fix this? I would really like to keep those changes ...
Same here on Windows 10 with WSL2 (howto). Version 0.10.27.
I hope that the recovery information in the docs can help you to get the change back. Meanwhile, a lot was improved, but hunk-related issues don't seem to have vanished entirely yet.
Yes, can you let us know if you're still facing issues?
We've improved a lot of the hunk management logic as well as the error reporting across all platforms (including introducing Windows builds, which should help if you're not actually trying to modify WSL repositories and instead were just using WSL to get Windows support).
On Mac (Version 0.11.5 (20240427.171108)), I hit the same issue. Nothing seemingly notable about said hunk.
Would you be willing to provide us the hunk that isn't applying correctly? If it has sensitive code we can have you send it to us privately :)
I would have but I had to resolve the issue and move on.
If I see it again, I’ll take the time to record it as I appreciate its impossible debug without an example.
The only context I can give though is that it was two files, both locked to that virtual branch, only additions and probably only a dozen LOC.
I could imagine how some complicated hunks could get tricky to resolve but this was seemingly a very simple diff.
Side note, loving the product though. Been using it exclusively during sprints at my job. I didn’t think it’d work very well when focussing on a ticket at a time but it’s allowed the Boy Scout rule to not conflict with the task at hand. Really enjoying it!
Thanks for the kind words! And thanks, yeah it's really tricky to debug these sorts of things without the hunks unfortunately. We're working on some ways to be able to help send us debugging information if help is needed to resolve things, but it'll be a bit before that's ready.
I'm going to go ahead and close this for now as there's not a whole to go off here. If you see this happening again, feel free to open a new ticket :)
Thanks for the report!
I run into this error pretty frequently in windows with the latest beta 0.11.7. I submitted some logs from the "share debug info" menu just now but I have quite a few other examples of it happening in some older logs I could send privately if that would help.