Git log tree: show relative path in title if under project
authorirengrig <Irina.Chernushina@jetbrains.com>
Wed, 28 Apr 2010 09:24:11 +0000 (13:24 +0400)
committerirengrig <Irina.Chernushina@jetbrains.com>
Wed, 28 Apr 2010 09:24:11 +0000 (13:24 +0400)
plugins/git4idea/src/git4idea/history/browser/GitProjectLogManager.java

index be594b46c8fdb13674862c094c95352637fc2e4c..7b5950294fb48684624346551a3b0e30b06f285c 100644 (file)
@@ -166,9 +166,11 @@ public class GitProjectLogManager implements ProjectComponent {
       if (baseDir.equals(root)) {
         result = "<Project root>";
       } else {
-        final String variant = VfsUtil.getRelativePath(baseDir, root, '/');
-        if ((variant != null) && (variant.length() < result.length())) {
-          result = variant;
+        if (VfsUtil.isAncestor(baseDir, root, true)) {
+          final String variant = VfsUtil.getRelativePath(root, baseDir, '/');
+          if (variant != null) {
+            result = variant;
+          }
         }
       }
     }