Tabnine Logo
DirCacheTree
Code IndexAdd Tabnine to your IDE (free)

How to use
DirCacheTree
in
org.eclipse.jgit.dircache

Best Java code snippets using org.eclipse.jgit.dircache.DirCacheTree (Showing top 20 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit

    final DirCacheTree p = tree.getChild(nextSubtreePos - 1);
    if (p.contains(cep, pathOffset, cep.length)) {
      nextSubtreePos--;
      currentSubtree = p;
if (nextSubtreePos != tree.getChildCount()) {
  final DirCacheTree s = tree.getChild(nextSubtreePos);
  if (s.contains(cep, pathOffset, cep.length)) {
    nextSubtreePos++;
    if (s.isValid())
      s.getObjectId().copyRawTo(subtreeId, 0);
    mode = FileMode.TREE.getBits();
    path = cep;
    pathLen = pathOffset + s.nameLength();
    return;
origin: org.eclipse.jgit/org.eclipse.jgit

DirCacheIterator(DirCacheIterator p, DirCacheTree dct) {
  super(p, p.path, p.pathLen + 1);
  cache = p.cache;
  tree = dct;
  treeStart = p.ptr;
  treeEnd = treeStart + tree.getEntrySpan();
  subtreeId = p.subtreeId;
  ptr = p.ptr;
  parseEntry();
}
origin: org.eclipse.jgit/org.eclipse.jgit

while (cIdx < cCnt) {
  final byte[] currPath = cache[cIdx].path;
  if (pathOff > 0 && !peq(firstPath, currPath, pathOff)) {
  final int cc = namecmp(currPath, pathOff, st);
  if (cc > 0) {
    removeChild(stIdx);
    continue;
    final int p = slash(currPath, pathOff);
    if (p < 0) {
    st = new DirCacheTree(this, currPath, pathOff, p - pathOff);
    insertChild(stIdx, st);
  st.validate(cache, cCnt, cIdx, pathOff + st.nameLength() + 1);
  cIdx += st.entrySpan;
  entrySpan += st.entrySpan;
  removeChild(childCnt - 1);
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Obtain (or build) the current cache tree structure.
 * <p>
 * This method can optionally recreate the cache tree, without flushing the
 * tree objects themselves to disk.
 *
 * @param build
 *            if true and the cache tree is not present in the index it will
 *            be generated and returned to the caller.
 * @return the cache tree; null if there is no current cache tree available
 *         and <code>build</code> was false.
 */
public DirCacheTree getCacheTree(boolean build) {
  if (build) {
    if (tree == null)
      tree = new DirCacheTree();
    tree.validate(sortedEntries, entryCnt, 0, 0);
  }
  return tree;
}
origin: org.eclipse.jgit/org.eclipse.jgit

private void appendName(StringBuilder r) {
  if (parent != null) {
    parent.appendName(r);
    r.append(getNameString());
    r.append('/');
  } else if (nameLength() > 0) {
    r.append(getNameString());
    r.append('/');
  }
}
origin: com.madgag/org.eclipse.jgit.pgm

  private void show(final DirCacheTree tree) throws IOException {
    outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
        tree.getPathString(), valueOf(tree.getEntrySpan()),
        valueOf(tree.getChildCount())));

    for (int i = 0; i < tree.getChildCount(); i++)
      show(tree.getChild(i));
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

private int computeSize(final DirCacheEntry[] cache, int cIdx,
    final int pathOffset, final ObjectInserter ow)
    throws UnmergedPathException, IOException {
  final int endIdx = cIdx + entrySpan;
  int childIdx = 0;
  int entryIdx = cIdx;
  int size = 0;
  while (entryIdx < endIdx) {
    final DirCacheEntry e = cache[entryIdx];
    if (e.getStage() != 0)
      throw new UnmergedPathException(e);
    final byte[] ep = e.path;
    if (childIdx < childCnt) {
      final DirCacheTree st = children[childIdx];
      if (st.contains(ep, pathOffset, ep.length)) {
        final int stOffset = pathOffset + st.nameLength() + 1;
        st.writeTree(cache, entryIdx, stOffset, ow);
        size += entrySize(TREE, st.nameLength());
        entryIdx += st.entrySpan;
        childIdx++;
        continue;
      }
    }
    size += entrySize(e.getFileMode(), ep.length - pathOffset);
    entryIdx++;
  }
  return size;
}
origin: org.eclipse.jgit/org.eclipse.jgit

if (id == null) {
  final int endIdx = cIdx + entrySpan;
  final TreeFormatter fmt = new TreeFormatter(computeSize(cache,
      cIdx, pathOffset, ow));
  int childIdx = 0;
    if (childIdx < childCnt) {
      final DirCacheTree st = children[childIdx];
      if (st.contains(ep, pathOffset, ep.length)) {
        fmt.append(st.encodedName, TREE, st.id);
        entryIdx += st.entrySpan;
origin: org.eclipse.jgit/org.eclipse.jgit

children = new DirCacheTree[subcnt];
for (int i = 0; i < subcnt; i++) {
  children[i] = new DirCacheTree(in, off, this);
origin: org.eclipse.jgit/org.eclipse.jgit

  /** {@inheritDoc} */
  @Override
  public String toString() {
    return getNameString();
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit

/**
 * Get the tree's path within the repository.
 * <p>
 * This method is not very efficient and is primarily meant for debugging
 * and final output generation. Applications should try to avoid calling it,
 * and if invoked do so only once per interesting entry, where the name is
 * absolutely required for correct function.
 *
 * @return path of the tree, relative to the repository root. If this is not
 *         the root tree the path ends with '/'. The root tree's path string
 *         is the empty string ("").
 */
public String getPathString() {
  final StringBuilder r = new StringBuilder();
  appendName(r);
  return r.toString();
}
origin: com.madgag/org.eclipse.jgit.pgm

  private void show(final DirCacheTree tree) throws IOException {
    outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
        tree.getPathString(), valueOf(tree.getEntrySpan()),
        valueOf(tree.getChildCount())));

    for (int i = 0; i < tree.getChildCount(); i++)
      show(tree.getChild(i));
  }
}
origin: sonia.jgit/org.eclipse.jgit

private void appendName(final StringBuilder r) {
  if (parent != null) {
    parent.appendName(r);
    r.append(getNameString());
    r.append('/');
  } else if (nameLength() > 0) {
    r.append(getNameString());
    r.append('/');
  }
}
origin: sonia.jgit/org.eclipse.jgit

private int computeSize(final DirCacheEntry[] cache, int cIdx,
    final int pathOffset, final ObjectInserter ow)
    throws UnmergedPathException, IOException {
  final int endIdx = cIdx + entrySpan;
  int childIdx = 0;
  int entryIdx = cIdx;
  int size = 0;
  while (entryIdx < endIdx) {
    final DirCacheEntry e = cache[entryIdx];
    if (e.getStage() != 0)
      throw new UnmergedPathException(e);
    final byte[] ep = e.path;
    if (childIdx < childCnt) {
      final DirCacheTree st = children[childIdx];
      if (st.contains(ep, pathOffset, ep.length)) {
        final int stOffset = pathOffset + st.nameLength() + 1;
        st.writeTree(cache, entryIdx, stOffset, ow);
        size += entrySize(TREE, st.nameLength());
        entryIdx += st.entrySpan;
        childIdx++;
        continue;
      }
    }
    size += entrySize(e.getFileMode(), ep.length - pathOffset);
    entryIdx++;
  }
  return size;
}
origin: sonia.jgit/org.eclipse.jgit

/**
 * Obtain (or build) the current cache tree structure.
 * <p>
 * This method can optionally recreate the cache tree, without flushing the
 * tree objects themselves to disk.
 *
 * @param build
 *            if true and the cache tree is not present in the index it will
 *            be generated and returned to the caller.
 * @return the cache tree; null if there is no current cache tree available
 *         and <code>build</code> was false.
 */
public DirCacheTree getCacheTree(final boolean build) {
  if (build) {
    if (tree == null)
      tree = new DirCacheTree();
    tree.validate(sortedEntries, entryCnt, 0, 0);
  }
  return tree;
}
origin: sonia.jgit/org.eclipse.jgit

if (id == null) {
  final int endIdx = cIdx + entrySpan;
  final TreeFormatter fmt = new TreeFormatter(computeSize(cache,
      cIdx, pathOffset, ow));
  int childIdx = 0;
    if (childIdx < childCnt) {
      final DirCacheTree st = children[childIdx];
      if (st.contains(ep, pathOffset, ep.length)) {
        fmt.append(st.encodedName, TREE, st.id);
        entryIdx += st.entrySpan;
origin: org.eclipse.jgit/org.eclipse.jgit

IO.readFully(in, raw, 0, raw.length);
md.update(raw, 0, raw.length);
tree = new DirCacheTree(raw, new MutableInteger(), null);
break;
origin: berlam/github-bucket

  /** {@inheritDoc} */
  @Override
  public String toString() {
    return getNameString();
  }
}
origin: sonia.jgit/org.eclipse.jgit

/**
 * Get the tree's path within the repository.
 * <p>
 * This method is not very efficient and is primarily meant for debugging
 * and final output generation. Applications should try to avoid calling it,
 * and if invoked do so only once per interesting entry, where the name is
 * absolutely required for correct function.
 *
 * @return path of the tree, relative to the repository root. If this is not
 *         the root tree the path ends with '/'. The root tree's path string
 *         is the empty string ("").
 */
public String getPathString() {
  final StringBuilder r = new StringBuilder();
  appendName(r);
  return r.toString();
}
origin: sonia.jgit/org.eclipse.jgit

while (cIdx < cCnt) {
  final byte[] currPath = cache[cIdx].path;
  if (pathOff > 0 && !peq(firstPath, currPath, pathOff)) {
  final int cc = namecmp(currPath, pathOff, st);
  if (cc > 0) {
    removeChild(stIdx);
    continue;
    final int p = slash(currPath, pathOff);
    if (p < 0) {
    st = new DirCacheTree(this, currPath, pathOff, p - pathOff);
    insertChild(stIdx, st);
  st.validate(cache, cCnt, cIdx, pathOff + st.nameLength() + 1);
  cIdx += st.entrySpan;
  entrySpan += st.entrySpan;
  removeChild(childCnt - 1);
org.eclipse.jgit.dircacheDirCacheTree

Javadoc

Single tree record from the 'TREE' org.eclipse.jgit.dircache.DirCacheextension.

A valid cache tree record contains the object id of a tree object and the total number of org.eclipse.jgit.dircache.DirCacheEntry instances (counted recursively) from the DirCache contained within the tree. This information facilitates faster traversal of the index and quicker generation of tree objects prior to creating a new commit.

An invalid cache tree record indicates a known subtree whose file entries have changed in ways that cause the tree to no longer have a known object id. Invalid cache tree records must be revalidated prior to use.

Most used methods

  • getChild
    Get the i-th child cache tree.
  • getChildCount
    Get the number of cached subtrees contained within this tree.
  • getEntrySpan
    Get the number of entries this tree spans within the DirCache. If this tree is not valid (see #isVal
  • <init>
  • appendName
  • computeSize
  • contains
  • getNameString
    Get the tree's name within its parent. This method is not very efficient and is primarily meant for
  • getObjectId
    Get the tree's ObjectId. If #isValid() returns false this method will return null.
  • insertChild
  • isValid
    Determine if this cache is currently valid. A valid cache tree knows how many org.eclipse.jgit.dirca
  • nameLength
  • isValid,
  • nameLength,
  • namecmp,
  • peq,
  • removeChild,
  • slash,
  • validate,
  • write,
  • writeTree,
  • getPathString

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • getApplicationContext (Context)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Socket (java.net)
    Provides a client-side TCP socket.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now