Package org.eclipse.jgit.dircache

Examples of org.eclipse.jgit.dircache.DirCache.builder()


      try {
        ObjectId treeId = db.resolve(BRANCH + "^{tree}");

        // Create the in-memory index of the new/updated ticket
        DirCache index = DirCache.newInCore();
        DirCacheBuilder builder = index.builder();

        // Traverse HEAD to add all other paths
        treeWalk = new TreeWalk(db);
        int hIdx = -1;
        if (treeId != null) {
View Full Code Here


  private DirCache createIndex(Repository db, long ticketId, Change change)
      throws IOException, ClassNotFoundException, NoSuchFieldException {

    String ticketPath = toTicketPath(ticketId);
    DirCache newIndex = DirCache.newInCore();
    DirCacheBuilder builder = newIndex.builder();
    ObjectInserter inserter = db.newObjectInserter();

    Set<String> ignorePaths = new TreeSet<String>();
    try {
      // create/update the journal
View Full Code Here

    checkCallable();
    DirCache dc = null;

    try {
      dc = repo.lockDirCache();
      DirCacheBuilder builder = dc.builder();
      final TreeWalk tw = new TreeWalk(repo);
      tw.reset(); // drop the first empty tree, which we do not need here
      tw.setRecursive(true);
      tw.setFilter(PathFilterGroup.createFromStrings(filepatterns));
      tw.addTree(new DirCacheBuildIterator(builder));
View Full Code Here

  }

  private ObjectId createTree(String... paths) throws IOException {
    final ObjectInserter odi = db.newObjectInserter();
    final DirCache dc = db.readDirCache();
    final DirCacheBuilder builder = dc.builder();
    for (String path : paths) {
      DirCacheEntry entry = createEntry(path, FileMode.REGULAR_FILE);
      builder.add(entry);
    }
    builder.finish();
View Full Code Here

        // Commit untracked changes
        ObjectId untrackedCommit = null;
        if (!untracked.isEmpty()) {
          DirCache untrackedDirCache = DirCache.newInCore();
          DirCacheBuilder untrackedBuilder = untrackedDirCache
              .builder();
          for (DirCacheEntry entry : untracked)
            untrackedBuilder.add(entry);
          untrackedBuilder.finish();
View Full Code Here

  @Test
  public void testNoPostOrder() throws Exception {
    final DirCache tree = db.readDirCache();
    {
      final DirCacheBuilder b = tree.builder();

      b.add(makeFile("a"));
      b.add(makeFile("b/c"));
      b.add(makeFile("b/d"));
      b.add(makeFile("q"));
View Full Code Here

  @Test
  public void testWithPostOrder_EnterSubtree() throws Exception {
    final DirCache tree = db.readDirCache();
    {
      final DirCacheBuilder b = tree.builder();

      b.add(makeFile("a"));
      b.add(makeFile("b/c"));
      b.add(makeFile("b/d"));
      b.add(makeFile("q"));
View Full Code Here

  @Test
  public void testWithPostOrder_NoEnterSubtree() throws Exception {
    final DirCache tree = db.readDirCache();
    {
      final DirCacheBuilder b = tree.builder();

      b.add(makeFile("a"));
      b.add(makeFile("b/c"));
      b.add(makeFile("b/d"));
      b.add(makeFile("q"));
View Full Code Here

  public void testNoDF_NoGap() throws Exception {
    final DirCache tree0 = db.readDirCache();
    final DirCache tree1 = db.readDirCache();
    {
      final DirCacheBuilder b0 = tree0.builder();
      final DirCacheBuilder b1 = tree1.builder();

      b0.add(createEntry("a", REGULAR_FILE));
      b0.add(createEntry("a.b", EXECUTABLE_FILE));
      b1.add(createEntry("a/b", REGULAR_FILE));
      b0.add(createEntry("a0b", SYMLINK));
View Full Code Here

  public void testDF_NoGap() throws Exception {
    final DirCache tree0 = db.readDirCache();
    final DirCache tree1 = db.readDirCache();
    {
      final DirCacheBuilder b0 = tree0.builder();
      final DirCacheBuilder b1 = tree1.builder();

      b0.add(createEntry("a", REGULAR_FILE));
      b0.add(createEntry("a.b", EXECUTABLE_FILE));
      b1.add(createEntry("a/b", REGULAR_FILE));
      b0.add(createEntry("a0b", SYMLINK));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.