/** * Set the expected value of the ref after the lock is taken, but before * update occurs. * * @param id * the expected value of the ref after the lock is taken, but * before update occurs. Null to avoid the compare and swap test. * Use {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to indicate * expectation of a non-existant ref. */ public void setExpectedOldObjectId(AnyObjectId id) { expValue = id != null ? id.toObjectId() : null; }
/** * Set start commit id * * @param commit * id of a commit * @return this command */ public BlameCommand setStartCommit(AnyObjectId commit) { this.startCommit = commit.toObjectId(); return this; }
/** * Configure the generator to compute reverse blame (history of deletes). * * @param start * oldest commit to traverse from. The result file will be loaded * from this commit's tree. * @param end * most recent commits to stop traversal at. Usually an active * branch tip, tag, or HEAD. * @return {@code this} * @throws java.io.IOException * the repository cannot be read. */ public BlameCommand reverse(AnyObjectId start, Collection<ObjectId> end) throws IOException { startCommit = start.toObjectId(); reverseEndCommits = new ArrayList<>(end); return this; }
private void advertiseAny(AnyObjectId obj, String refName) throws IOException { sent.add(obj.toObjectId()); advertiseId(obj, refName); }
/** * Configure the command to compute reverse blame (history of deletes). * * @param start * oldest commit to traverse from. The result file will be loaded * from this commit's tree. * @param end * most recent commit to stop traversal at. Usually an active * branch tip, tag, or HEAD. * @return {@code this} * @throws java.io.IOException * the repository cannot be read. */ public BlameCommand reverse(AnyObjectId start, AnyObjectId end) throws IOException { return reverse(start, Collections.singleton(end.toObjectId())); }
return reverse(start, Collections.singleton(end.toObjectId()));
/** * Include an object (and everything reachable from it) in the bundle. * * @param name * name the recipient can discover this object as from the * bundle's list of advertised refs . The name must be a valid * ref format and must not have already been included in this * bundle writer. * @param id * object to pack. Multiple refs may point to the same object. */ public void include(String name, AnyObjectId id) { boolean validRefName = Repository.isValidRefName(name) || Constants.HEAD.equals(name); if (!validRefName) throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidRefName, name)); if (include.containsKey(name)) throw new IllegalStateException(JGitText.get().duplicateRef + name); include.put(name, id.toObjectId()); }
/** {@inheritDoc} */ @Override protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) { try { super.verifySafeObject(id, type, data); } catch (CorruptObjectException e) { corruptObjects.add( new CorruptObject(id.toObjectId(), type, e.getErrorType())); } }
/** * Locate a reference to an annotated tag and immediately parse its content. * <p> * Unlike {@link #lookupTag(AnyObjectId)} this method only returns * successfully if the tag object exists, is verified to be a tag, and was * parsed without error. * * @param id * name of the tag object. * @return reference to the tag object. Never null. * @throws org.eclipse.jgit.errors.MissingObjectException * the supplied tag does not exist. * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException * the supplied id is not a tag or an annotated tag. * @throws java.io.IOException * a pack file or loose object could not be read. */ @NonNull public RevTag parseTag(AnyObjectId id) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevObject c = parseAny(id); if (!(c instanceof RevTag)) throw new IncorrectObjectTypeException(id.toObjectId(), Constants.TYPE_TAG); return (RevTag) c; }
/** * Locate a reference to a commit and immediately parse its content. * <p> * Unlike {@link #lookupCommit(AnyObjectId)} this method only returns * successfully if the commit object exists, is verified to be a commit, and * was parsed without error. * * @param id * name of the commit object. * @return reference to the commit object. Never null. * @throws org.eclipse.jgit.errors.MissingObjectException * the supplied commit does not exist. * @throws org.eclipse.jgit.errors.IncorrectObjectTypeException * the supplied id is not a commit or an annotated tag. * @throws java.io.IOException * a pack file or loose object could not be read. */ @NonNull public RevCommit parseCommit(AnyObjectId id) throws MissingObjectException, IncorrectObjectTypeException, IOException { RevObject c = peel(parseAny(id)); if (!(c instanceof RevCommit)) throw new IncorrectObjectTypeException(id.toObjectId(), Constants.TYPE_COMMIT); return (RevCommit) c; }
private void checkGitModules(ProgressMonitor pm, FsckError errors) throws IOException { pm.beginTask(JGitText.get().validatingGitModules, objChecker.getGitsubmodules().size()); for (GitmoduleEntry entry : objChecker.getGitsubmodules()) { AnyObjectId blobId = entry.getBlobId(); ObjectLoader blob = objdb.open(blobId, Constants.OBJ_BLOB); try { SubmoduleValidator.assertValidGitModulesFile( new String(blob.getBytes(), UTF_8)); } catch (SubmoduleValidationException e) { CorruptObject co = new FsckError.CorruptObject( blobId.toObjectId(), Constants.OBJ_BLOB, e.getFsckMessageId()); errors.getCorruptObjects().add(co); } pm.update(1); } pm.endTask(); }
/** * @param id * the expected value of the ref after the lock is taken, but * before update occurs. Null to avoid the compare and swap test. * Use {@link ObjectId#zeroId()} to indicate expectation of a * non-existant ref. */ public void setExpectedOldObjectId(final AnyObjectId id) { expValue = id != null ? id.toObjectId() : null; }
t = ((RevCommit) c).getTree(); else if (!(c instanceof RevTree)) throw new IncorrectObjectTypeException(id.toObjectId(), Constants.TYPE_TREE); else
/** * Set start commit id * * @param commit * @return this command */ public BlameCommand setStartCommit(AnyObjectId commit) { this.startCommit = commit.toObjectId(); return this; }
/** * Set start commit id * * @param commit * id of a commit * @return this command */ public BlameCommand setStartCommit(AnyObjectId commit) { this.startCommit = commit.toObjectId(); return this; }
/** * Set the expected value of the ref after the lock is taken, but before * update occurs. * * @param id * the expected value of the ref after the lock is taken, but * before update occurs. Null to avoid the compare and swap test. * Use {@link org.eclipse.jgit.lib.ObjectId#zeroId()} to indicate * expectation of a non-existant ref. */ public void setExpectedOldObjectId(AnyObjectId id) { expValue = id != null ? id.toObjectId() : null; }
private void advertiseAny(AnyObjectId obj, final String refName) throws IOException { sent.add(obj.toObjectId()); advertiseId(obj, refName); }
private void advertiseAny(AnyObjectId obj, String refName) throws IOException { sent.add(obj.toObjectId()); advertiseId(obj, refName); }
BlobCandidate c = new BlobCandidate(getRepository(), description, resultPath); c.sourceBlob = id.toObjectId(); c.sourceText = new RawText(ldr.getCachedBytes(Integer.MAX_VALUE)); c.regionList = new Region(0, 0, c.sourceText.size());
/** {@inheritDoc} */ @Override protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) { try { super.verifySafeObject(id, type, data); } catch (CorruptObjectException e) { corruptObjects.add( new CorruptObject(id.toObjectId(), type, e.getErrorType())); } }