Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349739 - Invalid value returned when getting GitArtifact full path
Summary: Invalid value returned when getting GitArtifact full path
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: 0.9   Edit
Assignee: Sebastien Dubois CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 348719
  Show dependency tree
 
Reported: 2011-06-17 17:51 EDT by Sebastien Dubois CLA
Modified: 2012-01-24 15:35 EST (History)
3 users (show)

See Also:


Attachments
tentative solution for bug 349739 (2.43 KB, text/plain)
2011-06-17 17:53 EDT, Sebastien Dubois CLA
no flags Details
updated comments in code (2.43 KB, text/plain)
2011-06-17 18:02 EDT, Sebastien Dubois CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien Dubois CLA 2011-06-17 17:51:09 EDT
There is a problem in the Git Connector where the path returned when getting a FileRevision full storage path is invalid.  The returned path is missing the root of the Git Repository (i.e. is starts one level too low).  This can cause multiple problems that could be very hard to track.  In our case, when using R4E to import Git Files as review item components for a Review, this could cause the compare editor to open the wrong file versions and show incorrect information.

So for example the following code will not return the correct path in artifactPath

IPath artifactPath = scmArtifact.getFileRevision(null).getStorage(null).getFullPath();

The solution is to prepend the repository path to the artifact path.  Take note that this is done correctly in Egit, but not in Mylyn Versions Git connector.
Comment 1 Sebastien Dubois CLA 2011-06-17 17:53:26 EDT
Created attachment 198220 [details]
tentative solution for bug 349739

This is a tentative solution for bug 349739
Comment 2 Sebastien Dubois CLA 2011-06-17 17:55:41 EDT
Take note that I have included a tentative solution for this bug.  Since I cannot commit changes to mylyn versions (I am not a committer on this project), I would like it to be reviewed and included ASAP.

Thanks,
/Sebastien
Comment 3 Sebastien Dubois CLA 2011-06-17 18:02:58 EDT
Created attachment 198221 [details]
updated comments in code
Comment 4 Alvaro Sanchez-Leon CLA 2011-06-24 22:00:35 EDT
I have made a quick check on the serialized data and I don't see any segments missing e.g. I used the R4E commit, 2011-Jun-17, 09:51:49, id: e5376d6..

See the repository paths below, they start with r4e which is the correct folder relative to the root of the repository.
Please clarify what's missing.

  <r4ecore:R4EFileVersion xmi:id="_CUCfQ57JEeCvAPj6HzzVzA" platformURI="platform:/resource/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" versionID="d26261e5d1552c35eecd3925a1b0332d8883e817" repositoryPath="r4e/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" name="RModelFactoryImpl.java" localVersionID="d26261e5d1552c35eecd3925a1b0332d8883e817" fileRevision="org.eclipse.mylyn.reviews.r4e.core.rfs.ReviewsRFSProxy$1@128537b"/>
  <r4ecore:R4EFileVersion xmi:id="_CU73IJ7JEeCvAPj6HzzVzA" platformURI="platform:/resource/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" versionID="d9c767a3b760930e1488d2b71f887b02ffa93984" repositoryPath="r4e/org.eclipse.mylyn.reviews.r4e.core/src/org/eclipse/mylyn/reviews/r4e/core/model/impl/RModelFactoryImpl.java" name="RModelFactoryImpl.java" localVersionID="d9c767a3b760930e1488d2b71f887b02ffa93984" fileRevision="org.eclipse.mylyn.reviews.r4e.core.rfs.ReviewsRFSProxy$1@6735fd"/>
  <r4ecore:R4EFileContext xmi:id="_CY80cJ7JEeCvAPj6HzzVzA" type="R4E_MODIFIED">
Comment 5 Sebastien Dubois CLA 2011-06-24 22:31:48 EDT
Like I said it works for R4E by luck, because R4E has a subdirectory r4e below the root repository.  But for project that do not have this e.g. JGit this will not work.  

You can easily reproduce the problem by trying to use commits from JGit.  

Also take note that, as I also stated above, EGit does the right thing.  The Mylyn Versions Git connector does not.
Comment 6 Sebastien Dubois CLA 2011-06-27 14:22:40 EDT
After investigating a little bit more, it appears that the EGit behavior is only valid for indexed files.  This means that the real solution to the problem is to fetch the correct contents from the local R4E repository when opening the comapre editor.
So the implementation of the solution is done on R4E and the bug is being moved accordingly
Comment 7 Sebastien Dubois CLA 2011-06-27 14:41:24 EDT
Fixed is now available