Package org.eclipse.jgit.gitrepo
Interface RepoCommand.RemoteReader
-
- All Known Implementing Classes:
RepoCommand.DefaultRemoteReader
- Enclosing class:
- RepoCommand
public static interface RepoCommand.RemoteReader
A callback to get ref sha1 of a repository from its uri. We provided a default implementationRepoCommand.DefaultRemoteReader
to use ls-remote command to read the sha1 from the repository and clone the repository to read the file. Callers may have their own quicker implementation.- Since:
- 3.4
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default byte[]
readFile(String uri, String ref, String path)
Deprecated.UsereadFileWithMode(String, String, String)
insteadRepoCommand.RemoteFile
readFileWithMode(String uri, String ref, String path)
Read contents and mode (i.e.ObjectId
sha1(String uri, String ref)
Read a remote ref sha1.
-
-
-
Method Detail
-
sha1
@Nullable ObjectId sha1(String uri, String ref) throws GitAPIException
Read a remote ref sha1.- Parameters:
uri
- The URI of the remote repositoryref
- Name of the ref to lookup. May be a short-hand form, e.g. "master" which is automatically expanded to "refs/heads/master" if "refs/heads/master" already exists.- Returns:
- the sha1 of the remote repository, or null if the ref does not exist.
- Throws:
GitAPIException
-
readFile
@Deprecated default byte[] readFile(String uri, String ref, String path) throws GitAPIException, IOException
Deprecated.UsereadFileWithMode(String, String, String)
insteadRead a file from a remote repository.- Parameters:
uri
- The URI of the remote repositoryref
- The ref (branch/tag/etc.) to readpath
- The relative path (inside the repo) to the file to read- Returns:
- the file content.
- Throws:
GitAPIException
IOException
- Since:
- 3.5
-
readFileWithMode
@NonNull RepoCommand.RemoteFile readFileWithMode(String uri, String ref, String path) throws GitAPIException, IOException
Read contents and mode (i.e. permissions) of the file from a remote repository.- Parameters:
uri
- The URI of the remote repositoryref
- Name of the ref to lookup. May be a short-hand form, e.g. "master" which is automatically expanded to "refs/heads/master" if "refs/heads/master" already exists.path
- The relative path (inside the repo) to the file to read- Returns:
- The contents and file mode of the file in the given repository and branch. Never null.
- Throws:
GitAPIException
- If the ref have an invalid or ambiguous name, or it does not exist in the repository,IOException
- If the object does not exist or is too large- Since:
- 5.2
-
-