Format of diff/patch to be accepted by the Git -> Patch -> Apply patch from clipboard?

Answered

Hi, what patch format should copilot/AI generate for a single file so that the patch could be applied via the “Apply patch from clipboard” menu option? Regenerating complete file takes too long and always drops some unrelated comments, generating just a diff is much more logical. But I could not find a way to apply such a diff in clipboard to an existing file, possibly being able to select individual chunks, just like the diff viewer in IntelliJ does.

Currently using Android Studio 2022.1.1, but IMO that feature is not there even in the latest IntelliJ Idea (the feature says “clipboard content is not a patch”).

 

Thanks a lot.

0
2 comments

It seems that if IntelliJ does not detect some familiar patch format, it just quietly quits the Apply patch dialogue. Also when AI generates incorrect line numbers (which is often the case), it quietly drops lines of the patch, without complaining about incompatible line numbers vs. patch contents.

Is there any chance to use a patch/diff format without the line numbers, just with the context before/after the changes? As of now it seems that interaction IntelliJ vs. AI is very difficult for larger files as AI tends to make many modifications when regenerating a large file, while a short diff without line numbers but with context lines would be perfectly sufficient - but unsupported by IntelliJ.

Thanks a lot for your opinion, IMO this is a major hassle.

0

Are you referring to a particular AI solution/plugin that doesn't produce a correctly formatted patch? 
Or are you developing some plugin that uses AI to apply modifications to a file via a diff patch?

0

Please sign in to leave a comment.