Package org.eclipse.jgit.lfs
Class LfsPrePushHook
- java.lang.Object
-
- org.eclipse.jgit.hooks.PrePushHook
-
- org.eclipse.jgit.lfs.LfsPrePushHook
-
public class LfsPrePushHook extends PrePushHook
Pre-push hook that handles uploading LFS artefacts.- Since:
- 4.11
-
-
Field Summary
Fields Modifier and Type Field Description protected PrintStream
errorStream
The error stream to be used by the hook.protected PrintStream
outputStream
The output stream to be used by the hook.-
Fields inherited from class org.eclipse.jgit.hooks.PrePushHook
NAME
-
-
Constructor Summary
Constructors Constructor Description LfsPrePushHook(Repository repo, PrintStream outputStream)
LfsPrePushHook(Repository repo, PrintStream outputStream, PrintStream errorStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
call()
protected void
doRun()
Runs the hook, without performing any validity checks.protected PrintStream
getErrorStream()
Get error streamprotected PrintStream
getOutputStream()
Get output streamprotected Repository
getRepository()
Get the repositoryboolean
isNativeHookPresent()
Check whether a 'native' (i.e.void
setRefs(Collection<RemoteRefUpdate> toRefs)
Set Refs-
Methods inherited from class org.eclipse.jgit.hooks.PrePushHook
getHookName, getParameters, getRemoteName, getStdinArgs, setRemoteLocation, setRemoteName
-
-
-
-
Field Detail
-
outputStream
protected final PrintStream outputStream
The output stream to be used by the hook.
-
errorStream
protected final PrintStream errorStream
The error stream to be used by the hook.
-
-
Constructor Detail
-
LfsPrePushHook
public LfsPrePushHook(Repository repo, PrintStream outputStream)
- Parameters:
repo
- the repositoryoutputStream
- not used by this implementation
-
LfsPrePushHook
public LfsPrePushHook(Repository repo, PrintStream outputStream, PrintStream errorStream)
- Parameters:
repo
- the repositoryoutputStream
- not used by this implementationerrorStream
- not used by this implementation- Since:
- 5.6
-
-
Method Detail
-
setRefs
public void setRefs(Collection<RemoteRefUpdate> toRefs)
Description copied from class:PrePushHook
Set Refs- Overrides:
setRefs
in classPrePushHook
- Parameters:
toRefs
- a collection ofRemoteRefUpdate
s
-
call
public String call() throws IOException, AbortedByHookException
Description copied from class:PrePushHook
Run the hook.
- Specified by:
call
in interfaceCallable<String>
- Overrides:
call
in classPrePushHook
- Throws:
IOException
AbortedByHookException
-
getRepository
protected Repository getRepository()
Get the repository- Returns:
- The repository.
-
getOutputStream
protected PrintStream getOutputStream()
Get output stream- Returns:
- The output stream the hook must use. Never
null
,System.out
is returned by default.
-
getErrorStream
protected PrintStream getErrorStream()
Get error stream- Returns:
- The error stream the hook must use. Never
null
,System.err
is returned by default.
-
doRun
protected void doRun() throws AbortedByHookException
Runs the hook, without performing any validity checks.- Throws:
AbortedByHookException
- If the underlying hook script exited with non-zero.
-
isNativeHookPresent
public boolean isNativeHookPresent()
Check whether a 'native' (i.e. script) hook is installed in the repository.- Returns:
- whether a native hook script is installed in the repository.
- Since:
- 4.11
-
-