Package org.eclipse.jgit.lfs
Class LfsPrePushHook
java.lang.Object
org.eclipse.jgit.hooks.GitHook<String>
org.eclipse.jgit.hooks.PrePushHook
org.eclipse.jgit.lfs.LfsPrePushHook
Pre-push hook that handles uploading LFS artefacts.
- Since:
- 4.11
-
Field Summary
FieldsFields inherited from class org.eclipse.jgit.hooks.PrePushHook
NAME
-
Constructor Summary
ConstructorsConstructorDescriptionLfsPrePushHook
(Repository repo, PrintStream outputStream) LfsPrePushHook
(Repository repo, PrintStream outputStream, PrintStream errorStream) -
Method Summary
Modifier and TypeMethodDescriptioncall()
private void
excludeRemoteRefs
(ObjectWalk walk) private static void
findLfsPointers
(Set<LfsPointer> toPush, ObjectWalk walk) private Set<LfsPointer>
private static long
getObjectSize
(ObjectReader r, RevObject obj) private static LfsPointer
loadLfsPointer
(ObjectReader r, AnyObjectId obj) private List<Protocol.ObjectInfo>
parseObjects
(com.google.gson.stream.JsonReader reader) private String
remote()
private Map<String,
LfsPointer> requestBatchUpload
(HttpConnection api, Set<LfsPointer> toPush) void
setRefs
(Collection<RemoteRefUpdate> toRefs) Set Refsprivate void
uploadContents
(HttpConnection api, Map<String, LfsPointer> oid2ptr) private void
uploadFile
(Protocol.ObjectInfo o, Protocol.Action uploadAction, Path path) Methods inherited from class org.eclipse.jgit.hooks.PrePushHook
getHookName, getParameters, getRemoteName, getStdinArgs, setRemoteLocation, setRemoteName
Methods inherited from class org.eclipse.jgit.hooks.GitHook
doRun, getErrorStream, getOutputStream, getRepository, handleError, isNativeHookPresent
-
Field Details
-
EMPTY
- See Also:
-
refs
-
-
Constructor Details
-
LfsPrePushHook
- Parameters:
repo
- the repositoryoutputStream
- not used by this implementation
-
LfsPrePushHook
- Parameters:
repo
- the repositoryoutputStream
- not used by this implementationerrorStream
- not used by this implementation- Since:
- 5.6
-
-
Method Details
-
setRefs
Description copied from class:PrePushHook
Set Refs- Overrides:
setRefs
in classPrePushHook
- Parameters:
toRefs
- a collection ofRemoteRefUpdate
s
-
call
Description copied from class:PrePushHook
Run the hook.
- Specified by:
call
in interfaceCallable<String>
- Overrides:
call
in classPrePushHook
- Throws:
IOException
AbortedByHookException
-
findObjectsToPush
private Set<LfsPointer> findObjectsToPush() throws IOException, MissingObjectException, IncorrectObjectTypeException -
findLfsPointers
private static void findLfsPointers(Set<LfsPointer> toPush, ObjectWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException -
getObjectSize
- Throws:
IOException
-
loadLfsPointer
- Throws:
IOException
-
excludeRemoteRefs
- Throws:
IOException
-
remote
-
requestBatchUpload
private Map<String,LfsPointer> requestBatchUpload(HttpConnection api, Set<LfsPointer> toPush) throws IOException - Throws:
IOException
-
uploadContents
- Throws:
IOException
-
parseObjects
-
uploadFile
private void uploadFile(Protocol.ObjectInfo o, Protocol.Action uploadAction, Path path) throws IOException, CorruptMediaFile - Throws:
IOException
CorruptMediaFile
-