Community
Participate
Working Groups
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
Created attachment 190972 [details] compare
Created attachment 190973 [details] side by side compare
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.
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">
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">
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] ...
(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)
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.
A shot in the dark: maybe it's another victim of bug 301775, just like bug 339397.
(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 ?
Tomasz, I am routing this to you. Could you close it if Jgit resolves it or we have a patch.
Is this still an issue?
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.
Marking as fixed, see the prev comment.