James Moger
2012-08-01 d65fb8f1b77a7254c22edc9e7d8f47b29ec33072
src/com/gitblit/utils/FileUtils.java
@@ -226,7 +226,10 @@
   public static String getRelativePath(File basePath, File path) {
      File exactBase = getExactFile(basePath);
      File exactPath = getExactFile(path);
      if (exactPath.getPath().startsWith(exactBase.getPath())) {
      if (path.getAbsolutePath().startsWith(basePath.getAbsolutePath())) {
         // absolute base-path match
         return StringUtils.getRelativePath(basePath.getAbsolutePath(), path.getAbsolutePath());
      } else if (exactPath.getPath().startsWith(exactBase.getPath())) {
         // canonical base-path match
         return StringUtils.getRelativePath(exactBase.getPath(), exactPath.getPath());
      } else if (exactPath.getPath().startsWith(basePath.getAbsolutePath())) {
@@ -235,9 +238,6 @@
      } else if (path.getAbsolutePath().startsWith(exactBase.getPath())) {
         // mixed path match
         return StringUtils.getRelativePath(exactBase.getPath(), path.getAbsolutePath());
      } else if (path.getAbsolutePath().startsWith(basePath.getAbsolutePath())) {
         // absolute base-path match
         return StringUtils.getRelativePath(basePath.getAbsolutePath(), path.getAbsolutePath());
      }
      // no relative relationship
      return null;