DESCRIPTION

Fix for RepositoryMapping returning wrong mapping.

The logic in getMapping did not cover the case properly when a path was
totally outside a repository mapping. For example, when workingTree is
"C:\my\working\tree" and the path in question is "D:\a\cloned\repo"
path.makeRelativ(workingTree) would return path "D:\a\cloned\repo". As a
result, the if clause is true and the mapping is returned although the
working tree from the mapping is completely unrelated to the path.

A better (and simpler) way is to simply use workingTree.isPrefixOf(path)
for the check. This properly determines if a path is within a working
tree.

The commit also adds a test for detecting the situation.

Bug: 403008
Change-Id: I5ecd9e75beb4da7eb9c36efbe91034067f343344
Signed-off-by: Rocco Fowler xxx@xxx.xxx


COMMENTS

author: Rocco Fowler
date: 2013-03-12 10:33:44.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2013-03-12 10:33:50.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/4269/ 

-------------------------------------
author: Brenden Conley
date: 2013-03-12 10:48:32.000000000

Patch Set 2: Verified

Build Successful 

https://hudson.eclipse.org/sandbox/job/egit.gerrit/4269/ : SUCCESS

-------------------------------------
author: Danika Greer
date: 2013-03-12 15:27:46.000000000

Patch Set 2: (3 inline comments)

Fix looks good, see minor inline comments. I remember that I wondered why it was using makeRelativeTo last time I looked at that part.

And could please you update the copyright headers?: http://wiki.eclipse.org/EGit/Contributor_Guide#Copyright

Line:95, org.eclipse.egit.core.test/src/org/eclipse/egit/core/project/RepositoryMappingTest.java -> thershouldnever -> thereshouldnever

Line:7, /COMMIT_MSG -> Remove the period. Also, maybe change to "Fix RepositoryMapping returning wrong mapping on Windows for different devices", as this is only a problem when there is a device part.

Line:12, /COMMIT_MSG -> makeRelativ -> makeRelativeTo

-------------------------------------
