public class FS_Win32_Cygwin extends FS_Win32
FS.Attributes, FS.ExecutionResult, FS.FSFactory, FS.LockToken
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
cygpath |
private static org.slf4j.Logger |
LOG |
DETECTED, NO_ENTRIES
Modifier | Constructor and Description |
---|---|
|
FS_Win32_Cygwin()
Constructor
|
protected |
FS_Win32_Cygwin(FS src)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
findHook(Repository repository,
java.lang.String hookName)
Tries to find a hook matching the given one in the given repository.
|
static boolean |
isCygwin()
Whether cygwin is found
|
FS |
newInstance()
Create a new instance of the same type of FS.
|
java.lang.String |
relativize(java.lang.String base,
java.lang.String other)
|
java.io.File |
resolve(java.io.File dir,
java.lang.String pn)
Resolve this file to its actual path name that the JRE can use.
|
ProcessResult |
runHookIfPresent(Repository repository,
java.lang.String hookName,
java.lang.String[] args,
java.io.PrintStream outRedirect,
java.io.PrintStream errRedirect,
java.lang.String stdinArgs)
Checks whether the given hook is defined for the given repository, then
runs it with the given arguments.
|
java.lang.ProcessBuilder |
runInShell(java.lang.String cmd,
java.lang.String[] args)
Initialize a ProcessBuilder to run a command using the system shell.
|
protected java.io.File |
userHomeImpl()
Determine the user's home directory (location where preferences are).
|
canExecute, discoverGitExe, getAttributes, isCaseSensitive, list, retryFailedLockFileCommit, setExecute, supportsExecute, supportsSymlinks
createNewFile, createNewFileAtomic, createSymLink, delete, detect, detect, discoverGitSystemConfig, execute, exists, fileAttributes, getFsTimerResolution, getGitSystemConfig, internalRunHookIfPresent, isDirectory, isFile, isHidden, isSymLink, lastModified, length, normalize, normalize, readPipe, readPipe, readSymLink, resolveGrandparentFile, runHookIfPresent, runProcess, runProcess, searchPath, setGitSystemConfig, setHidden, setLastModified, setUserHome, supportsAtomicCreateNewFile, userHome
private static final org.slf4j.Logger LOG
private static java.lang.String cygpath
public FS_Win32_Cygwin()
protected FS_Win32_Cygwin(FS src)
src
- instance whose attributes to copypublic static boolean isCygwin()
public FS newInstance()
newInstance
in class FS_Win32
public java.io.File resolve(java.io.File dir, java.lang.String pn)
This method can be relatively expensive. Computing a translation may require forking an external process per path name translated. Callers should try to minimize the number of translations necessary by caching the results.
Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 require translation for Cygwin based paths.
protected java.io.File userHomeImpl()
userHomeImpl
in class FS_Win32
public java.lang.ProcessBuilder runInShell(java.lang.String cmd, java.lang.String[] args)
runInShell
in class FS_Win32
cmd
- command to execute. This string should originate from the
end-user, and thus is platform specific.args
- arguments to pass to command. These should be protected from
shell evaluation.public java.lang.String relativize(java.lang.String base, java.lang.String other)
relativize
in class FS
base
- The path against which other
should be
relativized.other
- The path that will be made relative to base
.base
,
will yield the original other
.FileUtils.relativizePath(String, String, String, boolean)
public ProcessResult runHookIfPresent(Repository repository, java.lang.String hookName, java.lang.String[] args, java.io.PrintStream outRedirect, java.io.PrintStream errRedirect, java.lang.String stdinArgs) throws JGitInternalException
runHookIfPresent
in class FS
repository
- The repository for which a hook should be run.hookName
- The name of the hook to be executed.args
- Arguments to pass to this hook. Cannot be null
,
but can be an empty array.outRedirect
- A print stream on which to redirect the hook's stdout. Can be
null
, in which case the hook's standard output
will be lost.errRedirect
- A print stream on which to redirect the hook's stderr. Can be
null
, in which case the hook's standard error
will be lost.stdinArgs
- A string to pass on to the standard input of the hook. May be
null
.JGitInternalException
- if we fail to run the hook somehow. Causes may include an
interrupted process or I/O errors.public java.io.File findHook(Repository repository, java.lang.String hookName)