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

Bug 339670

Summary: [client] Wrong lines highlighted in the compare editor
Product: [ECD] Orion Reporter: Tomasz Zarna <tomasz.zarna>
Component: ClientAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: bokowski, libingw, Mike_Wilson, robin.rosenberg
Version: 0.2   
Target Milestone: 0.5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 301775    
Bug Blocks:    
Attachments:
Description Flags
compare
none
side by side compare
none
details of the change in git status none

Description Tomasz Zarna CLA 2011-03-11 06:47:44 EST
Steps:
1. Start a new project[1], don't forget about enabling Automatic git projects[2] first
2. Edit index.html, enter a title, description and author of the page:

change:
<title></title>
<meta name="description" content="">
<meta name="author" content="">
to:
<title>Tomek's page</title>
<meta name="description" content="This is my page">
<meta name="author" content="Tomek">

3. Save your changes
4. Open Git status for the project
5. Click on index.html in the Unstaged area
=> Green section highlights changes I made in 2., but the red one is not right
6. Open Side by side compare
=> Orange section highlights lines 6-8 while the changes are in lines 11-13

[1] http://wiki.eclipse.org/Orion/How_Tos/Demo#Starting_a_new_project
[2] http://wiki.eclipse.org/Orion/Server_admin_guide#Automatic_git_projects
Comment 1 Tomasz Zarna CLA 2011-03-11 06:49:00 EST
Created attachment 190972 [details]
compare
Comment 2 Tomasz Zarna CLA 2011-03-11 06:49:30 EST
Created attachment 190973 [details]
side by side compare
Comment 3 libing wang CLA 2011-03-11 08:08:39 EST
Tomosz , did you check the file with git diff command.
Boris had the similiar issue and reason is because the file has ^M and the diff gives the wrong position of line number.
Comment 4 Tomasz Zarna CLA 2011-03-11 08:22:02 EST
The result of GET http://localhost:8080/git/diff/Default/file/G/index.html is :

diff --git a/index.html b/index.html
index b4663af..7a74103 100644
--- a/index.html
+++ b/index.html
@@ -3,9 +3,9 @@
 	<meta charset="UTF-8">
 	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 	
-	<title></title>
-	<meta name="description" content="">
-	<meta name="author" content="">
+	<title>Tomek's page</title>
+	<meta name="description" content="This is my page">
+	<meta name="author" content="Tomek">
 	
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
Comment 5 libing wang CLA 2011-03-11 08:49:58 EST
The diff gives the wrong information on @@ -3,9 +3,9 @@
It is supposed to be @@ -8,9 +8,9 @@ (http://en.wikipedia.org/wiki/Diff)

I copied the the content of the file from tomasz and change the same lines and the diff on my side gives me the following result.
I believe in your case ,Tomasz , there must be some special chars that Diff could not treat the line delimeter correctly.


diff --git a/test123.js b/test123.js
index da7c10f..e4d2d4a 100644
--- a/test123.js
+++ b/test123.js
@@ -8,9 +8,9 @@
 	<meta charset="UTF-8">
 	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 
-	<title></title>
-	<meta name="description" content="">
-	<meta name="author" content="">
+	<title>sdfasf</title>
+	<meta name="description" content="sdfasdf">
+	<meta name="ssadfsa" content="">
 
 	<meta name="viewport" content="width=device-width, initial-scale=1.0">
Comment 6 Tomasz Zarna CLA 2011-03-11 09:12:50 EST
You're right, the file has mixed line endings:

<!doctype html>[LF]
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->[CR]
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->[CR]
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->[CR]
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->[CR]
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->[CR]
<head>[LF]
	<meta charset="UTF-8">[LF]
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">[LF]
	[LF]
	<title>Tomek's page</title>[LF]
	<meta name="description" content="This is my page">[LF]
	<meta name="author" content="Tomek">[LF]
	[LF]
...
Comment 7 Boris Bokowski CLA 2011-03-11 09:38:08 EST
(In reply to comment #6)
> You're right, the file has mixed line endings:

Yes, I know about this issue (and am papering over it while doing my demo)
Comment 8 libing wang CLA 2011-05-02 11:39:46 EDT
Mcq tried to use this work-flow for a demo and he failed.
I raised this to p2 as we should figure out a way to handle a file with mixed line endings.
I will first try to use git diff in command line to see how it gives back the diff.If it is a Jgit issue we should open a bug on that.
Comment 9 Tomasz Zarna CLA 2011-05-02 13:30:04 EDT
A shot in the dark: maybe it's another victim of bug 301775, just like bug 339397.
Comment 10 libing wang CLA 2011-05-02 16:08:25 EDT
(In reply to comment #9)
> A shot in the dark: maybe it's another victim of bug 301775, just like bug
> 339397.

I committed the index.html into my test repo and changed one line .
Then I used git diff cmd to see the diff , it gives the right diff.
Seems that JGit definitely gives wrong answer.
Should we open a separate bug on JGit ?
Comment 11 libing wang CLA 2011-07-21 11:47:49 EDT
Tomasz, I am routing this to you. Could you close it if Jgit resolves it or we have a patch.
Comment 12 Robin Rosenberg CLA 2012-06-07 18:06:33 EDT
Is this still an issue?
Comment 13 Tomasz Zarna CLA 2012-06-20 07:24:32 EDT
Created attachment 217626 [details]
details of the change in git status

(In reply to comment #12)
> Is this still an issue?

By following steps from comment 0 I'm no longer able to reproduce the issue. The comparison works as expected, see the screenshot.
Comment 14 Tomasz Zarna CLA 2012-06-20 07:31:15 EDT
Marking as fixed, see the prev comment.