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

Bug 368250

Summary: Compare views remove the last char of the displayed content
Product: [ECD] Orion Reporter: Szymon Brandys <Szymon.Brandys>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: mamacdon
Version: 0.3Flags: mamacdon: review+
Target Milestone: 0.4 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Szymon Brandys CLA 2012-01-10 09:10:56 EST
Steps:
1) Init a git repo
2) Add a file with one line "something" and commit
3) Modify the file and add the second line "something 2" (no enter at the end)
4) Go to Status View and show the change in the inline compare view

It shows:
something
something

Responses for diff and diff uris are ok. It seems that compare view just removes the last character.
Comment 1 libing wang CLA 2012-01-10 09:45:06 EST
I will investigate and fix it.
But in a long run(post 0.4), we may want to get the file content for both file URI(new and old). Currently we are generating the new file by diff+old.
Szymon, I know that your RTC integration does not provide new file content. Will that be hard to do so?
Comment 2 Szymon Brandys CLA 2012-02-01 04:22:42 EST
I'll check this out.
Comment 3 libing wang CLA 2012-02-14 16:56:01 EST
Found the reason:
The new file is generated by diff + original file.
Unified diff gives "\\ No newline at end of file" tag when there is no new line on either file.
Some times the diff contents contains "\r" at end and I had to remove that "\r".
But the code to remove this is not checking if a diff line is ending with "\r".
Comment 4 libing wang CLA 2012-02-14 16:59:50 EST
Got  a simple fix in origin/bug368250.
I've also run all the compare tests without failure.
Mark, could you help me on the review?
Comment 5 Mark Macdonald CLA 2012-02-15 10:46:04 EST
+1, Libing explained the fix to me and I looked at the code
Comment 6 libing wang CLA 2012-02-15 11:11:32 EST
fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8565f136c16f67576261eedd3725055e6353a970.
Added one more unit test case.