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

Bug 391148

Summary: JGit does no give back correct unified diff on files with mixed line ending.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: GitAssignee: Project Inbox <orion.git-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Silenio_Quarti, Szymon.Brandys
Version: 0.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
the file with mixed ending at line 150 none

Description libing wang CLA 2012-10-04 14:28:00 EDT
Just happened to find this file has mixed line ending at line 150(1 based number)
annotations.js. I will fix the line ending for this case but we need a solution on any other files that has this case.


Steps to reproduce:
1.Download the attached annotations.js.
2.Upload to Orion in a temporary folder
3.Commit 
4.Change line 150
5.Open git status page you will see that the diff is showing wrong.

I debugged on the diff response from server and found this:

"diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js b/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js"
"index 5291bda..acd1c72 100644"
"--- a/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js"
"+++ b/bundles/org.eclipse.orion.client.editor/web/orion/textview/annotations.js"
"@@ -147,7 +147,7 @@"
" 	 * @param {String} type The annotation type (for example, orion.annotation.error).
"
" 	 * @param {Object|Function} properties The common annotation properties of the registered
"
" 	 *		annotation type. All annotations create with this annotation type will expose these
"
"-	 *		properties.
	 */
"
"+	 *		test properties.
	 */
"
" 	AnnotationType.registerType = function(type, properties) {
"
" 		var constructor = properties;
"
" 		if (typeof constructor !== "function") { //$NON-NLS-0$
"

The original fiel at line 149-151 was like this 

	 *		annotation type. All annotations create with this annotation type will expose these
	 *		properties.
	 */

Apparently JGIT treated line 150 and 151 as one line.
Comment 1 libing wang CLA 2012-10-04 14:38:28 EDT
Created attachment 221918 [details]
the file with mixed ending at line 150
Comment 2 libing wang CLA 2012-10-04 14:46:18 EDT
I fixed the line ending at line 150 at annotations.js
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f2e6a3943ba2d53d5191d13ce2548e9be9461301.

This is not resolving the issue generically. We need the server to give back correct diff on mixed line ending cases.
Comment 3 John Arthorne CLA 2015-05-05 15:49:28 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html
Comment 4 John Arthorne CLA 2015-05-05 16:02:23 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html