aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
diff options
context:
space:
mode:
authorSebastian Schuberth <sschuberth@gmail.com>2015-05-19 09:30:02 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-05-21 23:29:28 +0200
commit8025443db4234bbf095e593434693141863753f8 (patch)
treee6336f291d1c0e153710eb9a029962b5175105e0 /org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
parent686124bec32fcdee1545e7d9c312dcf0276b44af (diff)
downloadjgit-8025443db4234bbf095e593434693141863753f8.tar.gz
jgit-8025443db4234bbf095e593434693141863753f8.zip
Move resolveGrandparentFile() to the base class for wider use
Change-Id: I67ec732ea2e5345a6946783f0c5ef60c07ce254e Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
index d11b03e679..762b36ecb9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -508,6 +508,21 @@ public abstract class FS {
protected abstract File discoverGitPrefix();
/**
+ * @param grandchild
+ * @return the parent directory of this file's parent directory or
+ * {@code null} in case there's no grandparent directory
+ * @since 4.0
+ */
+ protected static File resolveGrandparentFile(File grandchild) {
+ if (grandchild != null) {
+ File parent = grandchild.getParentFile();
+ if (parent != null)
+ return parent.getParentFile();
+ }
+ return null;
+ }
+
+ /**
* Set the $prefix directory C Git uses.
*
* @param path