/** * Set the identity of the object, if its not already set. * * @param id * the id of the object that is too large to process. */ public void setObjectId(AnyObjectId id) { if (objectId == null) objectId = id.copy(); }
LargeObject(int type, long size, File path, AnyObjectId id, FileObjectDatabase db) { this.type = type; this.size = size; this.path = path; this.id = id.copy(); this.source = db; }
/** * Set the parent of this commit. * * @param newParent * the single parent for the commit. */ public void setParentId(AnyObjectId newParent) { parentIds = new ObjectId[] { newParent.copy() }; }
/** * Set the object this tag refers to, and its type. * * @param obj * the object. * @param objType * the type of {@code obj}. Must be a valid type code. */ public void setObjectId(AnyObjectId obj, int objType) { object = obj.copy(); type = objType; }
/** * Set the tree id for this commit object * * @param id * the tree identity. */ public void setTreeId(AnyObjectId id) { treeId = id.copy(); }
/** * A record of (tree, blob) for a .gitmodule file in a pack * * @param treeId * tree id containing a .gitmodules entry * @param blobId * id of the blob of the .gitmodules file */ public GitmoduleEntry(AnyObjectId treeId, AnyObjectId blobId) { // AnyObjectId's are reused, must keep a copy. this.treeId = treeId.copy(); this.blobId = blobId.copy(); }
/** * Set the new value the ref will update to. * * @param id * the new value. */ public void setNewObjectId(AnyObjectId id) { newValue = id.copy(); }
ObjCursorImpl(long scanEnd, AnyObjectId id) { this.scanEnd = scanEnd; this.match = id.copy(); }
/** * Set the parents of this commit. * * @param parent1 * the first parent of this commit. Typically this is the current * value of the {@code HEAD} reference and is thus the current * branch's position in history. * @param parent2 * the second parent of this merge commit. Usually this is the * branch being merged into the current branch. */ public void setParentIds(AnyObjectId parent1, AnyObjectId parent2) { parentIds = new ObjectId[] { parent1.copy(), parent2.copy() }; }
/** * Set the parents of this commit. * * @param newParents * the entire list of parents for this commit. */ public void setParentIds(List<? extends AnyObjectId> newParents) { parentIds = new ObjectId[newParents.size()]; for (int i = 0; i < newParents.size(); i++) parentIds[i] = newParents.get(i).copy(); }
private void recordError(AnyObjectId id, Throwable what) { final ObjectId objId = id.copy(); List<Throwable> errors = fetchErrors.get(objId); if (errors == null) { errors = new ArrayList<>(2); fetchErrors.put(objId, errors); } errors.add(what); }
/** * Add a parent onto the end of the parent list. * * @param additionalParent * new parent to add onto the end of the current parent list. */ public void addParentId(AnyObjectId additionalParent) { if (parentIds.length == 0) { setParentId(additionalParent); } else { ObjectId[] newParents = new ObjectId[parentIds.length + 1]; System.arraycopy(parentIds, 0, newParents, 0, parentIds.length); newParents[parentIds.length] = additionalParent.copy(); parentIds = newParents; } }
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; }
/** * Include a commit * * @param name * a name given to the commit * @param commit * the Id of a commit which is cherry-picked to the current head * @return {@code this} */ public CherryPickCommand include(String name, AnyObjectId commit) { return include(new ObjectIdRef.Unpeeled(Storage.LOOSE, name, commit.copy())); }
/** * Include a commit * * @param name * a name of a {@code Ref} pointing to the commit * @param aCommit * the Id of a commit which is merged with the current head * @return {@code this} */ public MergeCommand include(String name, AnyObjectId aCommit) { return include(new ObjectIdRef.Unpeeled(Storage.LOOSE, name, aCommit.copy())); }
void parseOneEntry(AnyObjectId noteOn, AnyObjectId noteData) { growIfFull(); notes[cnt++] = new Note(noteOn, noteData.copy()); }
/** {@inheritDoc} */ @Override public long getObjectSize(AnyObjectId objectId, int typeHint) throws MissingObjectException, IncorrectObjectTypeException, IOException { long sz = db.getObjectSize(this, objectId); if (sz < 0) { if (typeHint == OBJ_ANY) throw new MissingObjectException(objectId.copy(), JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); } return sz; }
/** * Include a commit to be reverted * * @param name * name of a {@code Ref} referring to the commit * @param commit * the Id of a commit which is reverted into the current head * @return {@code this} */ public RevertCommand include(String name, AnyObjectId commit) { return include(new ObjectIdRef.Unpeeled(Storage.LOOSE, name, commit.copy())); }
/** {@inheritDoc} */ @Override public long findCRC32(AnyObjectId objId) throws MissingObjectException { final int levelOne = objId.getFirstByte(); final int levelTwo = binarySearchLevelTwo(objId, levelOne); if (levelTwo == -1) throw new MissingObjectException(objId.copy(), "unknown"); //$NON-NLS-1$ return NB.decodeUInt32(crc32[levelOne], levelTwo << 2); }