diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java index 3b3e10e7b2..a8b866d25b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java @@ -68,6 +68,7 @@ public class Git implements AutoCloseable { * @return a {@link org.eclipse.jgit.api.Git} object for the existing git * repository * @throws java.io.IOException + * if an IO error occurred */ public static Git open(File dir) throws IOException { return open(dir, FS.DETECTED); @@ -84,6 +85,7 @@ public class Git implements AutoCloseable { * @return a {@link org.eclipse.jgit.api.Git} object for the existing git * repository. Closing this instance will close the repo. * @throws java.io.IOException + * if an IO error occurred */ public static Git open(File dir, FS fs) throws IOException { RepositoryCache.FileKey key; @@ -199,7 +201,24 @@ public class Git implements AutoCloseable { this(repo, false); } - Git(Repository repo, boolean closeRepo) { + /** + * Construct a new {@link org.eclipse.jgit.api.Git} object which can + * interact with the specified git repository. + * <p> + * All command classes returned by methods of this class will always + * interact with this git repository. + * <p> + * If {@code closeRepo = false} the caller is responsible for closing the + * repository. + * + * @param repo + * the git repository this class is interacting with; + * {@code null} is not allowed. + * @param closeRepo + * whether to close the repository when this instance is closed + * @since 7.4 + */ + public Git(Repository repo, boolean closeRepo) { this.repo = requireNonNull(repo); this.closeRepo = closeRepo; } @@ -712,6 +731,16 @@ public class Git implements AutoCloseable { } /** + * Return a command object to execute a {@code PackRefs} command + * + * @return a {@link org.eclipse.jgit.api.PackRefsCommand} + * @since 7.1 + */ + public PackRefsCommand packRefs() { + return new PackRefsCommand(repo); + } + + /** * Return a command object to find human-readable names of revisions. * * @return a {@link org.eclipse.jgit.api.NameRevCommand}. @@ -792,7 +821,6 @@ public class Git implements AutoCloseable { return repo; } - /** {@inheritDoc} */ @Override public String toString() { return "Git[" + repo + "]"; //$NON-NLS-1$//$NON-NLS-2$ |