@Override protected void run() throws Exception { final org.eclipse.jgit.transport.ReceivePack rp; try { FileKey key = FileKey.lenient(dstGitdir, FS.DETECTED); db = key.open(true /* must exist */); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, dstGitdir.getPath())); } rp = new org.eclipse.jgit.transport.ReceivePack(db); rp.receive(ins, outs, errs); } }
@Override protected void run() throws Exception { final org.eclipse.jgit.transport.UploadPack up; try { FileKey key = FileKey.lenient(srcGitdir, FS.DETECTED); db = key.open(true /* must exist */); } catch (RepositoryNotFoundException notFound) { throw die(MessageFormat.format(CLIText.get().notAGitRepository, srcGitdir.getPath())); } up = new org.eclipse.jgit.transport.UploadPack(db); if (0 <= timeout) up.setTimeout(timeout); up.upload(ins, outs, errs); } }
repository = RepositoryCache.open(FileKey.lenient(gitdir, FS.DETECTED), 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); }
/** * @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); }
public Repository openRepository(String name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } try { final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); return RepositoryCache.open(loc); } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot open repository " + name); e2.initCause(e1); throw e2; } }
public Repository openRepository(String name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } try { final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED); return RepositoryCache.open(loc); } catch (IOException e1) { final RepositoryNotFoundException e2; e2 = new RepositoryNotFoundException("Cannot open repository " + name); e2.initCause(e1); throw e2; } }
/** * 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); }