jira-importer commented on issue #880: URL: https://github.com/apache/maven-scm/issues/880#issuecomment-2964631007
**[Robert Scholte](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rfscholte)** commented Using the `canonicalPath` was also one of my first thought, but it has one downside: you must catch its `IOException`. Than again: why compare `String`s? I'd hoped we had learned from `Date` and `Integer` that you should try to compare their `toString()`-values. So I was thinking of adding a method `isAncestor()`, which should loop over every `file.parentFile()` and checks if it is equal to the `workingDirectory`. Let the OS do this comparison. See also [File.equals()](http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html#equals(java.lang.Object)) Are you really sure you can't use `URI.relativize()`? That would be a real clean solution. Btw, it's a public method, so it's quite easy to test. In other words: we'll need some extra tests here. I'm not sure if you can use a Windows-path on a Linux environment, otherwise we'll just have to check the OS first. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
