Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 483334

Summary: Apply patch does not work with non-ascii characters
Product: [ECD] Orion Reporter: Silenio Quarti <Silenio_Quarti>
Component: GitAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: xintong
Version: 11.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
possible fix none

Description Silenio Quarti CLA 2015-11-30 16:30:39 EST
Create a patch for a file that has non-ascii characters.  Applying this patch fails.

It seems that the patch has the correct contents in UTF8 encoding.  The contents is corrupted when the patch is applied.

JGit ApplyCommand.java#200 seems to cast all bytes to characters. 

for (int j = hh.getStartOffset(); j < hh.getEndOffset(); j++)
			hunk.append((char) hh.getBuffer()[j]);
Comment 1 Silenio Quarti CLA 2015-11-30 18:50:12 EST
Created attachment 258370 [details]
possible fix

I believe this fixes the problem in JGit. Need to submit a bug upstream.
Comment 2 Xintong Wang CLA 2015-12-08 15:14:01 EST
submitted jgit patch for https://bugs.eclipse.org/bugs/show_bug.cgi?id=483943
Comment 3 Grant Gayed CLA 2016-01-07 11:28:20 EST
Closing report since this is not an Orion problem.  Will monitor the bug+patch logged with JGit.