diff options
Diffstat (limited to 'org.eclipse.jgit.java7')
-rw-r--r-- | org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_POSIX_Java7.java | 16 | ||||
-rw-r--r-- | org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_Win32_Java7Cygwin.java | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_POSIX_Java7.java b/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_POSIX_Java7.java index 4a73a9bcf5..300cf93bc8 100644 --- a/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_POSIX_Java7.java +++ b/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_POSIX_Java7.java @@ -53,6 +53,9 @@ import java.nio.file.Path; import java.nio.file.attribute.PosixFilePermission; import java.util.Set; +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.Repository; + /** * FS implementation for Java7 on unix like systems */ @@ -344,4 +347,17 @@ public class FS_POSIX_Java7 extends FS_POSIX { public String normalize(String name) { return FileUtil.normalize(name); } + + /** + * @since 3.7 + */ + @Override + public File findHook(Repository repository, Hook hook) { + final File gitdir = repository.getDirectory(); + final Path hookPath = gitdir.toPath().resolve(Constants.HOOKS) + .resolve(hook.getName()); + if (Files.isExecutable(hookPath)) + return hookPath.toFile(); + return null; + } } diff --git a/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_Win32_Java7Cygwin.java b/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_Win32_Java7Cygwin.java index e40d7cf0b5..b6e5d93885 100644 --- a/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_Win32_Java7Cygwin.java +++ b/org.eclipse.jgit.java7/src/org/eclipse/jgit/util/FS_Win32_Java7Cygwin.java @@ -45,6 +45,11 @@ package org.eclipse.jgit.util; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.Repository; /** * FS for Java7 on Windows with Cygwin @@ -135,4 +140,17 @@ public class FS_Win32_Java7Cygwin extends FS_Win32_Cygwin { public Attributes getAttributes(File path) { return FileUtil.getFileAttributesBasic(this, path); } + + /** + * @since 3.7 + */ + @Override + public File findHook(Repository repository, Hook hook) { + final File gitdir = repository.getDirectory(); + final Path hookPath = gitdir.toPath().resolve(Constants.HOOKS) + .resolve(hook.getName()); + if (Files.isExecutable(hookPath)) + return hookPath.toFile(); + return null; + } } |