/** * Create the stream from an existing loader's cached bytes. * * @param loader * the loader. */ public SmallStream(ObjectLoader loader) { this(loader.getType(), loader.getCachedBytes()); }
@Override public int getType() { return delegate().getType(); }
private static ObjectLoader checkType(ObjectLoader ldr, AnyObjectId id, int typeHint) throws IncorrectObjectTypeException { if (typeHint != OBJ_ANY && ldr.getType() != typeHint) { throw new IncorrectObjectTypeException(id.copy(), typeHint); } return ldr; }
public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { ObjectId revId = repository.resolve(Constants.HEAD); try (TreeWalk treeWalk = new TreeWalk(repository)) { try (RevWalk revWalk = new RevWalk(repository)) { treeWalk.addTree(revWalk.parseTree(revId)); while (treeWalk.next()) { System.out.println("---------------------------"); System.out.append("name: ").println(treeWalk.getNameString()); System.out.append("path: ").println(treeWalk.getPathString()); ObjectLoader loader = repository.open(treeWalk.getObjectId(0)); System.out.append("directory: ").println(loader.getType() == Constants.OBJ_TREE); System.out.append("size: ").println(loader.getSize()); } } } } } }
public static void main(String[] args) throws IOException { try (Repository repository = CookbookHelper.openJGitCookbookRepository()) { ObjectId revId = repository.resolve(Constants.HEAD); try (TreeWalk treeWalk = new TreeWalk(repository)) { try (RevWalk revWalk = new RevWalk(repository)) { treeWalk.addTree(revWalk.parseTree(revId)); while (treeWalk.next()) { System.out.println("---------------------------"); System.out.append("name: ").println(treeWalk.getNameString()); System.out.append("path: ").println(treeWalk.getPathString()); ObjectLoader loader = repository.open(treeWalk.getObjectId(0)); System.out.append("directory: ").println(loader.getType() == Constants.OBJ_TREE); System.out.append("size: ").println(loader.getSize()); } } } } } }
/** * Loosen objects in a pack file which are not also in the newly-created * pack files. * * @param inserter * @param reader * @param pack * @param existing * @throws IOException */ private void loosen(ObjectDirectoryInserter inserter, ObjectReader reader, PackFile pack, HashSet<ObjectId> existing) throws IOException { for (PackIndex.MutableEntry entry : pack) { ObjectId oid = entry.toObjectId(); if (existing.contains(oid)) { continue; } existing.add(oid); ObjectLoader loader = reader.open(oid); inserter.insert(loader.getType(), loader.getSize(), loader.openStream(), true /* create this object even though it's a duplicate */); } }
MissingObjectException, IOException { RevObject r; int type = ldr.getType(); switch (type) { case Constants.OBJ_COMMIT: {
/** {@inheritDoc} */ @Override public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { final ObjectLoader ldr = db.openObject(this, objectId); if (ldr == null) { if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); } if (typeHint != OBJ_ANY && ldr.getType() != typeHint) throw new IncorrectObjectTypeException(objectId.copy(), typeHint); return ldr; }
final int type = uol.getType(); final byte[] raw = uol.getCachedBytes(); if (objCheck != null) {
visit.data = ldr.getCachedBytes(Integer.MAX_VALUE); visit.id = baseId; final int typeCode = ldr.getType(); final PackedObjectInfo oe = newInfo(baseId, null, null); oe.setType(typeCode);
/** * Create the stream from an existing loader's cached bytes. * * @param loader * the loader. */ public SmallStream(ObjectLoader loader) { this(loader.getType(), loader.getCachedBytes()); }
@Override public int getType() { return delegate().getType(); }
/** * Create the stream from an existing loader's cached bytes. * * @param loader * the loader. */ public SmallStream(ObjectLoader loader) { this(loader.getType(), loader.getCachedBytes()); }
@NotNull private ObjectId copy(@NotNull ObjectInserter inserter, @NotNull ObjectLoader loader) throws IOException { try (ObjectStream stream = loader.openStream()) { return inserter.insert(loader.getType(), loader.getSize(), stream); } }
private static ObjectLoader checkType(ObjectLoader ldr, AnyObjectId id, int typeHint) throws IncorrectObjectTypeException { if (typeHint != OBJ_ANY && ldr.getType() != typeHint) { throw new IncorrectObjectTypeException(id.copy(), typeHint); } return ldr; }
private static ObjectLoader checkType(ObjectLoader ldr, AnyObjectId id, int typeHint) throws IncorrectObjectTypeException { if (typeHint != OBJ_ANY && ldr.getType() != typeHint) { throw new IncorrectObjectTypeException(id.copy(), typeHint); } return ldr; }
throws IOException { ObjectLoader ldr = reader.open(id); if (ldr.getType() == OBJ_BLOB) { if (description == null) description = JGitText.get().blameNotCommittedYet;
public void pullObject(ObjectId id, boolean flush, GfsObjectService sourceObjService) throws IOException { if(!hasObject(id)) { ObjectLoader loader = sourceObjService.open(id); switch(loader.getType()) { case OBJ_TREE: pullTree(id, sourceObjService); break; case OBJ_BLOB: pullBlob(id, sourceObjService); break; default: throw new UnsupportedOperationException(id.toString()); } if(flush) flush(); } }
public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { final ObjectLoader ldr = db.openObject(this, objectId); if (ldr == null) { if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); } if (typeHint != OBJ_ANY && ldr.getType() != typeHint) throw new IncorrectObjectTypeException(objectId.copy(), typeHint); return ldr; }
/** {@inheritDoc} */ @Override public ObjectLoader open(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { final ObjectLoader ldr = db.openObject(this, objectId); if (ldr == null) { if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); } if (typeHint != OBJ_ANY && ldr.getType() != typeHint) throw new IncorrectObjectTypeException(objectId.copy(), typeHint); return ldr; }