Package org.eclipse.jgit.util
Class FS_Win32_Cygwin
java.lang.Object
org.eclipse.jgit.util.FS
org.eclipse.jgit.util.FS_Win32
org.eclipse.jgit.util.FS_Win32_Cygwin
FS implementation for Cygwin on Windows
- Since:
- 3.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.util.FS
FS.Attributes, FS.ExecutionResult, FS.FileStoreAttributes, FS.FSFactory, FS.LockToken
-
Field Summary
FieldsFields inherited from class org.eclipse.jgit.util.FS
DETECTED, NO_ENTRIES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isCygwin()
Whether cygwin is foundCreate a new instance of the same type of FS.relativize
(String base, String other) Resolve this file to its actual path name that the JRE can use.runHookIfPresent
(Repository repository, String hookName, String[] args, OutputStream outRedirect, OutputStream errRedirect, String stdinArgs) Checks whether the given hook is defined for the given repository, then runs it with the given arguments.runInShell
(String cmd, String[] args) Initialize a ProcessBuilder to run a command using the system shell.(package private) String
shellQuote
(String cmd) Quote a string (such as a file system path obtained from a JavaFile
orPath
object) such that it can be passed as first argument toFS.runInShell(String, String[])
.protected File
Determine the user's home directory (location where preferences are).Methods inherited from class org.eclipse.jgit.util.FS_Win32
canExecute, discoverGitExe, getAttributes, isCaseSensitive, list, retryFailedLockFileCommit, setExecute, supportsExecute
Methods inherited from class org.eclipse.jgit.util.FS
createNewFile, createNewFileAtomic, createSymLink, delete, detect, detect, discoverGitSystemConfig, execute, exists, fileAttributes, findHook, getFileStoreAttributes, getGitSystemConfig, internalRunHookIfPresent, isDirectory, isFile, isHidden, isSymLink, lastModified, lastModifiedInstant, lastModifiedInstant, length, normalize, normalize, readPipe, readPipe, readSymLink, resolveGrandparentFile, runHookIfPresent, runProcess, runProcess, searchPath, setAsyncFileStoreAttributes, setGitSystemConfig, setHidden, setLastModified, setLastModified, setUserHome, supportsAtomicCreateNewFile, supportsSymlinks, userHome
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
cygpath
-
-
Constructor Details
-
FS_Win32_Cygwin
public FS_Win32_Cygwin()Constructor -
FS_Win32_Cygwin
Constructor- Parameters:
src
- instance whose attributes to copy
-
-
Method Details
-
isCygwin
public static boolean isCygwin()Whether cygwin is found- Returns:
- true if cygwin is found
-
newInstance
Create a new instance of the same type of FS.- Overrides:
newInstance
in classFS_Win32
- Returns:
- a new instance of the same type of FS.
-
resolve
Resolve this file to its actual path name that the JRE can use.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.
-
userHomeImpl
Determine the user's home directory (location where preferences are).- Overrides:
userHomeImpl
in classFS_Win32
- Returns:
- the user's home directory; null if the user does not have one.
-
runInShell
Initialize a ProcessBuilder to run a command using the system shell.- Overrides:
runInShell
in classFS_Win32
- Parameters:
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.- Returns:
- a partially completed process builder. Caller should finish populating directory, environment, and then start the process.
-
shellQuote
Description copied from class:FS
Quote a string (such as a file system path obtained from a JavaFile
orPath
object) such that it can be passed as first argument toFS.runInShell(String, String[])
.This default implementation returns the string unchanged.
- Overrides:
shellQuote
in classFS
- Parameters:
cmd
- the String to quote- Returns:
- the quoted string
-
relativize
- Overrides:
relativize
in classFS
- Parameters:
base
- The path against whichother
should be relativized.other
- The path that will be made relative tobase
.- Returns:
- A relative path that, when resolved against
base
, will yield the originalother
. - See Also:
-
runHookIfPresent
public ProcessResult runHookIfPresent(Repository repository, String hookName, String[] args, OutputStream outRedirect, OutputStream errRedirect, String stdinArgs) throws JGitInternalException Checks whether the given hook is defined for the given repository, then runs it with the given arguments.- Overrides:
runHookIfPresent
in classFS
- Parameters:
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 benull
, but can be an empty array.outRedirect
- A print stream on which to redirect the hook's stdout. Can benull
, in which case the hook's standard output will be lost.errRedirect
- A print stream on which to redirect the hook's stderr. Can benull
, 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 benull
.- Returns:
- The ProcessResult describing this hook's execution.
- Throws:
JGitInternalException
- if we fail to run the hook somehow. Causes may include an interrupted process or I/O errors.
-