/** * Open repository * * @param dir * the repository to open. May be either the GIT_DIR, or the * working tree directory that contains {@code .git}. * @param fs * filesystem abstraction to use when accessing the repository. * @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 */ public static Git open(File dir, FS fs) throws IOException { RepositoryCache.FileKey key; key = RepositoryCache.FileKey.lenient(dir, fs); Repository db = new RepositoryBuilder().setFS(fs).setGitDir(key.getFile()) .setMustExist(true).build(); return new Git(db, true); }
/** * @param dir * the repository to open. May be either the GIT_DIR, or the * working tree directory that contains {@code .git}. * @param fs * filesystem abstraction to use when accessing the repository. * @return a {@link Git} object for the existing git repository. Closing this * instance will close the repo. * @throws IOException */ public static Git open(File dir, FS fs) throws IOException { RepositoryCache.FileKey key; key = RepositoryCache.FileKey.lenient(dir, fs); Repository db = new RepositoryBuilder().setFS(fs).setGitDir(key.getFile()) .setMustExist(true).build(); return new Git(db, true); }
/** * Open repository * * @param dir * the repository to open. May be either the GIT_DIR, or the * working tree directory that contains {@code .git}. * @param fs * filesystem abstraction to use when accessing the repository. * @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 */ public static Git open(File dir, FS fs) throws IOException { RepositoryCache.FileKey key; key = RepositoryCache.FileKey.lenient(dir, fs); Repository db = new RepositoryBuilder().setFS(fs).setGitDir(key.getFile()) .setMustExist(true).build(); return new Git(db, true); }