Top Description Fields Constructors Methods
org.eclipse.jgit.lfs

public Class LfsPrePushHook

extends PrePushHook
Class Inheritance
Static Imports
java.nio.charset.StandardCharsets.UTF_8, org.eclipse.jgit.lfs.Protocol.OPERATION_UPLOAD, org.eclipse.jgit.lfs.internal.LfsConnectionFactory.toRequest, org.eclipse.jgit.transport.http.HttpConnection.HTTP_OK, org.eclipse.jgit.util.HttpSupport.METHOD_POST, .HttpSupport.METHOD_PUT

Pre-push hook that handles uploading LFS artefacts.
Since
4.11

Field Summary

Modifier and TypeField and Description
private static final String
private Collection<RemoteRefUpdate>
Inherited from org.eclipse.jgit.hooks.PrePushHook:
NAME

Constructor Summary

AccessConstructor and Description
public
LfsPrePushHook(Repository
the repository
repo
,
PrintStream
not used by this implementation
outputStream
)

public
LfsPrePushHook(Repository
the repository
repo
,
PrintStream
not used by this implementation
outputStream
,
PrintStream
not used by this implementation
errorStream
)

Method Summary

Modifier and TypeMethod and Description
public String
call()

Overrides org.eclipse.jgit.hooks.PrePushHook.call.

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

private void
private static void
private Set<LfsPointer>
private static long
private static LfsPointer
private List<Protocol.ObjectInfo>
private String
private Map<String, LfsPointer>
public void
setRefs(Collection<RemoteRefUpdate>
a collection of RemoteRefUpdates
toRefs
)

Overrides org.eclipse.jgit.hooks.PrePushHook.setRefs.

Set Refs

private void
private void
Inherited from org.eclipse.jgit.hooks.PrePushHook:
getHookNamegetParametersgetRemoteNamegetStdinArgsisDryRunsetDryRunsetRemoteLocationsetRemoteName

Field Detail

EMPTYback to summary
private static final String EMPTY
refsback to summary
private Collection<RemoteRefUpdate> refs

Hides org.eclipse.jgit.hooks.PrePushHook.refs.

Constructor Detail

LfsPrePushHookback to summary
public LfsPrePushHook(Repository repo, PrintStream outputStream)
Parameters
repo:Repository

the repository

outputStream:PrintStream

not used by this implementation

LfsPrePushHookback to summary
public LfsPrePushHook(Repository repo, PrintStream outputStream, PrintStream errorStream)
Parameters
repo:Repository

the repository

outputStream:PrintStream

not used by this implementation

errorStream:PrintStream

not used by this implementation

Since
5.6

Method Detail

callback to summary
public String call() throws IOException, AbortedByHookException

Overrides org.eclipse.jgit.hooks.PrePushHook.call.

Implements java.util.concurrent.Callable.call.

Doc from org.eclipse.jgit.hooks.GitHook.call.

Computes a result, or throws an exception if unable to do so.

Run the hook.

Returns:String

Doc from java.util.concurrent.Callable.call.

computed result

Annotations
@Override
excludeRemoteRefsback to summary
private void excludeRemoteRefs(ObjectWalk walk) throws IOException
findLfsPointersback to summary
private static void findLfsPointers(Set<LfsPointer> toPush, ObjectWalk walk) throws MissingObjectException, IncorrectObjectTypeException, IOException
findObjectsToPushback to summary
private Set<LfsPointer> findObjectsToPush() throws IOException, MissingObjectException, IncorrectObjectTypeException
getObjectSizeback to summary
private static long getObjectSize(ObjectReader r, RevObject obj) throws IOException
loadLfsPointerback to summary
private static LfsPointer loadLfsPointer(ObjectReader r, AnyObjectId obj) throws IOException
parseObjectsback to summary
private List<Protocol.ObjectInfo> parseObjects(JsonReader reader)
remoteback to summary
private String remote()
requestBatchUploadback to summary
private Map<String, LfsPointer> requestBatchUpload(HttpConnection api, Set<LfsPointer> toPush) throws IOException
setRefsback to summary
public void setRefs(Collection<RemoteRefUpdate> toRefs)

Overrides org.eclipse.jgit.hooks.PrePushHook.setRefs.

Doc from org.eclipse.jgit.hooks.PrePushHook.setRefs.

Set Refs

Parameters
toRefs:Collection<RemoteRefUpdate>

a collection of RemoteRefUpdates

Annotations
@Override
uploadContentsback to summary
private void uploadContents(HttpConnection api, Map<String, LfsPointer> oid2ptr) throws IOException
uploadFileback to summary
private void uploadFile(Protocol.ObjectInfo o, Protocol.Action uploadAction, Path path) throws IOException, CorruptMediaFile