org.eclipse.jgit.dircache.DirCacheEntry Java Examples

The following examples show how to use org.eclipse.jgit.dircache.DirCacheEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubtreeMerger.java    From git-merge-repos with Apache License 2.0 6 votes vote down vote up
private DirCache createTreeDirCache(Map<SubtreeConfig, RevCommit> parentCommits,
		String commitMessage) throws IOException {

	try (TreeWalk treeWalk = new TreeWalk(repository)) {
		treeWalk.setRecursive(true);
		addTrees(parentCommits, treeWalk);

		DirCacheBuilder builder = DirCache.newInCore().builder();
		while (treeWalk.next()) {
			AbstractTreeIterator iterator = getSingleTreeIterator(treeWalk, commitMessage);
			if (iterator == null) {
				throw new IllegalStateException(
						"Tree walker did not return a single tree (should not happen): "
								+ treeWalk.getPathString());
			}
			byte[] path = Arrays.copyOf(iterator.getEntryPathBuffer(),
					iterator.getEntryPathLength());
			DirCacheEntry entry = new DirCacheEntry(path);
			entry.setFileMode(iterator.getEntryFileMode());
			entry.setObjectId(iterator.getEntryObjectId());
			builder.add(entry);
		}
		builder.finish();
		return builder.getDirCache();
	}
}
 
Example #2
Source File: CacheIterator.java    From ParallelGit with Apache License 2.0 6 votes vote down vote up
public boolean findNext() {
  while(index < entries.length) {
    DirCacheEntry entry = entries[index++];
    String nextPath = "/" + entry.getPathString();
    if(directParentLength == -1)
      next = CacheNode.file(nextPath, entry);
    else {
      if(prev != null && prev.hasChild(nextPath))
        continue;
      int end = nextPath.indexOf('/', directParentLength);
      next = end != -1 ? CacheNode.directory(nextPath.substring(0, end)) : CacheNode.file(nextPath, entry);
    }
    return true;
  }
  return false;
}
 
Example #3
Source File: CacheIterator.java    From ParallelGit with Apache License 2.0 6 votes vote down vote up
public boolean findNext() {
  while(index < entries.length) {
    DirCacheEntry entry = entries[index++];
    String nextPath = "/" + entry.getPathString();
    if(directParentLength == -1)
      next = CacheNode.file(nextPath, entry);
    else {
      if(prev != null && prev.hasChild(nextPath))
        continue;
      int end = nextPath.indexOf('/', directParentLength);
      next = end != -1 ? CacheNode.directory(nextPath.substring(0, end)) : CacheNode.file(nextPath, entry);
    }
    return true;
  }
  return false;
}
 
Example #4
Source File: GitManagerImpl.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private DirCacheEntry[] findEntrys(Repository repository, String path) throws IOException {
    DirCache dirCache = repository.readDirCache();

    int eIdx = dirCache.findEntry(path);
    if (eIdx < 0) {
        throw new GitInvalidPathException(format("%s is not found in git index", path));
    }

    int lastIdx = dirCache.nextEntry(eIdx);

    final DirCacheEntry[] entries = new DirCacheEntry[lastIdx - eIdx];
    for (int i=0; i<entries.length; i++) {
        entries[i] = dirCache.getEntry(eIdx + i);
    }

    return entries;
}
 
Example #5
Source File: AbstractGitTestCase.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected static void assertDirCacheEntry (Repository repository, File workDir, Collection<File> files) throws IOException {
    DirCache cache = repository.lockDirCache();
    for (File f : files) {
        String relativePath = Utils.getRelativePath(workDir, f);
        DirCacheEntry e = cache.getEntry(relativePath);
        assertNotNull(e);
        assertEquals(relativePath, e.getPathString());
        if (f.lastModified() != e.getLastModified()) {
            assertEquals((f.lastModified() / 1000) * 1000, (e.getLastModified() / 1000) * 1000);
        }
        try (InputStream in = new FileInputStream(f)) {
            assertEquals(e.getObjectId(), repository.newObjectInserter().idFor(Constants.OBJ_BLOB, f.length(), in));
        }
        if (e.getLength() == 0 && f.length() != 0) {
            assertTrue(e.isSmudged());
        } else {
            assertEquals(f.length(), e.getLength());
        }
    }
    cache.unlock();
}
 
Example #6
Source File: AddTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testAddMissingSymlink () throws Exception {
    if (isWindows()) {
        return;
    }
    String path = "folder/file";
    File f = new File(workDir, path);
    
    // try with commandline client
    File link = new File(workDir, "link");
    Files.createSymbolicLink(Paths.get(link.getAbsolutePath()), Paths.get(path));
    getClient(workDir).add(new File[] { link }, NULL_PROGRESS_MONITOR);
    DirCacheEntry e = repository.readDirCache().getEntry(link.getName());
    assertEquals(FileMode.SYMLINK, e.getFileMode());
    assertEquals(0, e.getLength());
    try (ObjectReader reader = repository.getObjectDatabase().newReader()) {
        assertTrue(reader.has(e.getObjectId()));
        byte[] bytes = reader.open(e.getObjectId()).getBytes();
        assertEquals(path, RawParseUtils.decode(bytes));
    }
}
 
Example #7
Source File: ResolveMerger.java    From onedev with MIT License 6 votes vote down vote up
/**
 * Reverts the worktree after an unsuccessful merge. We know that for all
 * modified files the old content was in the old index and the index
 * contained only stage 0. In case if inCore operation just clear the
 * history of modified files.
 *
 * @throws java.io.IOException
 * @throws org.eclipse.jgit.errors.CorruptObjectException
 * @throws org.eclipse.jgit.errors.NoWorkTreeException
 * @since 3.4
 */
protected void cleanUp() throws NoWorkTreeException,
		CorruptObjectException,
		IOException {
	if (inCore) {
		modifiedFiles.clear();
		return;
	}

	DirCache dc = nonNullRepo().readDirCache();
	Iterator<String> mpathsIt=modifiedFiles.iterator();
	while(mpathsIt.hasNext()) {
		String mpath = mpathsIt.next();
		DirCacheEntry entry = dc.getEntry(mpath);
		if (entry != null) {
			DirCacheCheckout.checkoutEntry(db, entry, reader, false,
					checkoutMetadata.get(mpath));
		}
		mpathsIt.remove();
	}
}
 
Example #8
Source File: ResolveMerger.java    From onedev with MIT License 6 votes vote down vote up
private void checkout() throws NoWorkTreeException, IOException {
	// Iterate in reverse so that "folder/file" is deleted before
	// "folder". Otherwise this could result in a failing path because
	// of a non-empty directory, for which delete() would fail.
	for (int i = toBeDeleted.size() - 1; i >= 0; i--) {
		String fileName = toBeDeleted.get(i);
		File f = new File(nonNullRepo().getWorkTree(), fileName);
		if (!f.delete())
			if (!f.isDirectory())
				failingPaths.put(fileName,
						MergeFailureReason.COULD_NOT_DELETE);
		modifiedFiles.add(fileName);
	}
	for (Map.Entry<String, DirCacheEntry> entry : toBeCheckedOut
			.entrySet()) {
		DirCacheEntry cacheEntry = entry.getValue();
		if (cacheEntry.getFileMode() == FileMode.GITLINK) {
			new File(nonNullRepo().getWorkTree(), entry.getKey()).mkdirs();
		} else {
			DirCacheCheckout.checkoutEntry(db, cacheEntry, reader, false,
					checkoutMetadata.get(entry.getKey()));
			modifiedFiles.add(entry.getKey());
		}
	}
}
 
Example #9
Source File: GfsDefaultCheckoutCacheTest.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
@Nonnull
private DirCacheEntry someEntry(String path, int stage) {
  DirCacheEntry ret = new DirCacheEntry(normalizeNodePath(path), stage);
  ret.setFileMode(REGULAR_FILE);
  ret.setObjectId(someObjectId());
  return ret;
}
 
Example #10
Source File: CheckoutIndex.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void checkoutEntry (Repository repository, File file, DirCacheEntry e, ObjectReader od) throws IOException, GitException {
    // ... create/overwrite this file ...
    if (!ensureParentFolderExists(file.getParentFile())) {
        return;
    }

    boolean exists = file.exists();
    if (exists && e.getFileMode() == FileMode.SYMLINK) {
        monitor.notifyWarning(MessageFormat.format(Utils.getBundle(CheckoutIndex.class).getString("MSG_Warning_SymLink"), file.getAbsolutePath())); //NOI18N
        return;
    }

    if (Utils.isFromNested(e.getFileMode().getBits())) {
        if (!exists) {
            file.mkdirs();
        }
    } else {
        if (exists && file.isDirectory()) {
            monitor.notifyWarning(MessageFormat.format(Utils.getBundle(CheckoutIndex.class).getString("MSG_Warning_ReplacingDirectory"), file.getAbsolutePath())); //NOI18N
            Utils.deleteRecursively(file);
        }
        file.createNewFile();
        if (file.isFile()) {
            DirCacheCheckout.checkoutEntry(repository, e, od);
        } else {
            monitor.notifyError(MessageFormat.format(Utils.getBundle(CheckoutIndex.class).getString("MSG_Warning_CannotCreateFile"), file.getAbsolutePath())); //NOI18N
        }
    }
}
 
Example #11
Source File: StashApplyCommand.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
private void checkoutPath(DirCacheEntry entry, ObjectReader reader) {
	try {
		DirCacheCheckout.checkoutEntry(repo, entry, reader);
	} catch (IOException e) {
		throw new JGitInternalException(MessageFormat.format(JGitText.get().checkoutConflictWithFile, entry.getPathString()), e);
	}
}
 
Example #12
Source File: Index.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
public ObjectStream toObjectStream() throws IOException {
	DirCache cache = db.readDirCache();
	DirCacheEntry entry = cache.getEntry(pattern);
	if (entry == null) {
		return null;
	}
	try {
		ObjectId blobId = entry.getObjectId();
		return db.open(blobId, Constants.OBJ_BLOB).openStream();
	} catch (MissingObjectException e) {
		return null;
	}
}
 
Example #13
Source File: GitRepository.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(DirCacheEntry ent) {
    try {
        ent.setObjectId(inserter.insert(Constants.OBJ_BLOB, Jackson.writeValueAsBytes(jsonNode)));
        ent.setFileMode(FileMode.REGULAR_FILE);
    } catch (IOException e) {
        throw new StorageException("failed to create a new JSON blob", e);
    }
}
 
Example #14
Source File: GitRepository.java    From centraldogma with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(DirCacheEntry ent) {
    try {
        ent.setObjectId(inserter.insert(Constants.OBJ_BLOB, text.getBytes(UTF_8)));
        ent.setFileMode(FileMode.REGULAR_FILE);
    } catch (IOException e) {
        throw new StorageException("failed to create a new text blob", e);
    }
}
 
Example #15
Source File: ResolveMerger.java    From onedev with MIT License 5 votes vote down vote up
private boolean isWorktreeDirty(WorkingTreeIterator work,
		DirCacheEntry ourDce) throws IOException {
	if (work == null)
		return false;

	final int modeF = tw.getRawMode(T_FILE);
	final int modeO = tw.getRawMode(T_OURS);

	// Worktree entry has to match ours to be considered clean
	boolean isDirty;
	if (ourDce != null)
		isDirty = work.isModified(ourDce, true, reader);
	else {
		isDirty = work.isModeDifferent(modeO);
		if (!isDirty && nonTree(modeF))
			isDirty = !tw.idEqual(T_FILE, T_OURS);
	}

	// Ignore existing empty directories
	if (isDirty && modeF == FileMode.TYPE_TREE
			&& modeO == FileMode.TYPE_MISSING)
		isDirty = false;
	if (isDirty)
		failingPaths.put(tw.getPathString(),
				MergeFailureReason.DIRTY_WORKTREE);
	return isDirty;
}
 
Example #16
Source File: CheckoutTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testLargeFile () throws Exception {
    unpack("large.dat.zip");
    File large = new File(workDir, "large.dat");
    assertTrue(large.exists());
    assertEquals(2158310, large.length());
    add();
    DirCache cache = repository.readDirCache();
    DirCacheEntry e = cache.getEntry("large.dat");
    WindowCacheConfig cfg = new WindowCacheConfig();
    cfg.setStreamFileThreshold((int) large.length() - 1);
    cfg.install();
    DirCacheCheckout.checkoutEntry(repository, e, repository.newObjectReader());
}
 
Example #17
Source File: ResetTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testResetConflict () throws Exception {
    File file = new File(workDir, "file");
    write(file, "init");
    File[] files = new File[] { file };
    add(files);
    commit(files);

    DirCache index = repository.lockDirCache();
    DirCacheBuilder builder = index.builder();
    DirCacheEntry e = index.getEntry(file.getName());
    DirCacheEntry e1 = new DirCacheEntry(file.getName(), 1);
    e1.setCreationTime(e.getCreationTime());
    e1.setFileMode(e.getFileMode());
    e1.setLastModified(e.getLastModified());
    e1.setLength(e.getLength());
    e1.setObjectId(e.getObjectId());
    builder.add(e1);
    builder.finish();
    builder.commit();
    
    GitClient client = getClient(workDir);
    Map<File, GitStatus> status = client.getStatus(files, NULL_PROGRESS_MONITOR);
    assertTrue(status.get(file).isConflict());
    assertEquals(GitConflictDescriptor.Type.BOTH_DELETED, status.get(file).getConflictDescriptor().getType());
    
    client.reset(files, "HEAD", true, NULL_PROGRESS_MONITOR);
    status = client.getStatus(files, NULL_PROGRESS_MONITOR);
    assertFalse(status.get(file).isConflict());
}
 
Example #18
Source File: AddTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddNested () throws Exception {
    File f = new File(workDir, "f");
    write(f, "file");
    
    GitClient client = getClient(workDir);
    client.add(new File[] { f }, NULL_PROGRESS_MONITOR);
    client.commit(new File[] { f }, "init commit", null, null, NULL_PROGRESS_MONITOR);
    
    Thread.sleep(1100);
    File nested = new File(workDir, "nested");
    nested.mkdirs();
    File f2 = new File(nested, "f");
    write(f2, "file");
    GitClient clientNested = getClient(nested);
    clientNested.init(NULL_PROGRESS_MONITOR);
    clientNested.add(new File[] { f2 }, NULL_PROGRESS_MONITOR);
    clientNested.commit(new File[] { f2 }, "aaa", null, null, NULL_PROGRESS_MONITOR);
    write(f2, "change");
    
    Thread.sleep(1000);
    client.add(new File[] { workDir }, NULL_PROGRESS_MONITOR);
    Map<File, GitStatus> statuses = client.getStatus(new File[] { workDir }, NULL_PROGRESS_MONITOR);
    assertEquals(2, statuses.size());
    assertStatus(statuses, workDir, f, true, Status.STATUS_NORMAL, Status.STATUS_NORMAL, Status.STATUS_NORMAL, false);
    // nested should be added as gitlink
    assertStatus(statuses, workDir, nested, true, Status.STATUS_ADDED, Status.STATUS_NORMAL, Status.STATUS_ADDED, false);
    DirCacheEntry e = repository.readDirCache().getEntry("nested");
    assertEquals(FileMode.GITLINK, e.getFileMode());
    assertEquals(nested.length(), e.getLength());
    assertNotSame(ObjectId.zeroId().name(), e.getObjectId().getName());
    
    statuses = clientNested.getStatus(new File[] { nested }, NULL_PROGRESS_MONITOR);
    assertEquals(1, statuses.size());
    assertStatus(statuses, nested, f2, true, Status.STATUS_NORMAL, Status.STATUS_MODIFIED, Status.STATUS_MODIFIED, false);
}
 
Example #19
Source File: AddTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void assertDirCacheEntryModified (Collection<File> files) throws IOException {
    DirCache cache = repository.lockDirCache();
    for (File f : files) {
        String relativePath = Utils.getRelativePath(workDir, f);
        DirCacheEntry e = cache.getEntry(relativePath);
        assertNotNull(e);
        assertEquals(relativePath, e.getPathString());
        try (InputStream in = new FileInputStream(f)) {
            assertNotSame(e.getObjectId(), repository.newObjectInserter().idFor(Constants.OBJ_BLOB, f.length(), in));
        }
    }
    cache.unlock();
}
 
Example #20
Source File: CacheEntryUpdate.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(DirCacheEntry ent) {
  if(newBlob != null)
    ent.setObjectId(newBlob);
  if(newFileMode != null)
    ent.setFileMode(newFileMode);
}
 
Example #21
Source File: ResolveMerger.java    From onedev with MIT License 5 votes vote down vote up
/**
 * adds a entry to the index builder which is a copy of the specified
 * DirCacheEntry
 *
 * @param e
 *            the entry which should be copied
 *
 * @return the entry which was added to the index
 */
private DirCacheEntry keep(DirCacheEntry e) {
	DirCacheEntry newEntry = new DirCacheEntry(e.getRawPath(),
			e.getStage());
	newEntry.setFileMode(e.getFileMode());
	newEntry.setObjectId(e.getObjectId());
	newEntry.setLastModified(e.getLastModifiedInstant());
	newEntry.setLength(e.getLength());
	builder.add(newEntry);
	return newEntry;
}
 
Example #22
Source File: AbstractParallelGitTest.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
public static void assertCacheEquals(@Nullable String message, DirCache expected, DirCache actual) {
  if(expected != actual) {
    String header = message == null ? "" : message + ": ";
    int cacheSize = assertCacheSameSize(expected, actual, header);
    DirCacheEntry[] expectedEntries = expected.getEntriesWithin("");
    DirCacheEntry[] actualEntries = actual.getEntriesWithin("");
    for(int i = 0; i < cacheSize; ++i) {
      DirCacheEntry expectedEntry = expectedEntries[i];
      DirCacheEntry actualEntry = actualEntries[i];
      assertCacheEntryEquals(expectedEntry, actualEntry, header, i);
    }
  }
}
 
Example #23
Source File: AbstractParallelGitTest.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
private static void assertCacheEntryEquals(DirCacheEntry expected, DirCacheEntry actual, String header, int index) {
  try {
    assertEquals("fileMode", expected.getFileMode(), actual.getFileMode());
    assertEquals("length", expected.getLength(), actual.getLength());
    assertEquals("objectId", expected.getObjectId(), actual.getObjectId());
    assertEquals("stage", expected.getStage(), actual.getStage());
    assertEquals("path", expected.getPathString(), actual.getPathString());
  } catch(AssertionError e) {
    fail(header + "caches first differed at entry [" + index + "]; " + e.getMessage());
  }
}
 
Example #24
Source File: GfsDefaultCheckoutCacheTest.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
@Nonnull
private DirCacheEntry someEntry(String path, int stage) {
  DirCacheEntry ret = new DirCacheEntry(normalizeNodePath(path), stage);
  ret.setFileMode(REGULAR_FILE);
  ret.setObjectId(someObjectId());
  return ret;
}
 
Example #25
Source File: CacheEntryUpdate.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(DirCacheEntry ent) {
  if(newBlob != null)
    ent.setObjectId(newBlob);
  if(newFileMode != null)
    ent.setFileMode(newFileMode);
}
 
Example #26
Source File: ResolveMerger.java    From onedev with MIT License 5 votes vote down vote up
/**
 * adds a new path with the specified stage to the index builder
 *
 * @param path
 * @param p
 * @param stage
 * @param lastMod
 * @param len
 * @return the entry which was added to the index
 */
private DirCacheEntry add(byte[] path, CanonicalTreeParser p, int stage,
		Instant lastMod, long len) {
	if (p != null && !p.getEntryFileMode().equals(FileMode.TREE)) {
		DirCacheEntry e = new DirCacheEntry(path, stage);
		e.setFileMode(p.getEntryFileMode());
		e.setObjectId(p.getEntryObjectId());
		e.setLastModified(lastMod);
		e.setLength(len);
		builder.add(e);
		return e;
	}
	return null;
}
 
Example #27
Source File: AbstractParallelGitTest.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
public static void assertCacheEquals(@Nullable String message, DirCache expected, DirCache actual) {
  if(expected != actual) {
    String header = message == null ? "" : message + ": ";
    int cacheSize = assertCacheSameSize(expected, actual, header);
    DirCacheEntry[] expectedEntries = expected.getEntriesWithin("");
    DirCacheEntry[] actualEntries = actual.getEntriesWithin("");
    for(int i = 0; i < cacheSize; ++i) {
      DirCacheEntry expectedEntry = expectedEntries[i];
      DirCacheEntry actualEntry = actualEntries[i];
      assertCacheEntryEquals(expectedEntry, actualEntry, header, i);
    }
  }
}
 
Example #28
Source File: AbstractParallelGitTest.java    From ParallelGit with Apache License 2.0 5 votes vote down vote up
private static void assertCacheEntryEquals(DirCacheEntry expected, DirCacheEntry actual, String header, int index) {
  try {
    assertEquals("fileMode", expected.getFileMode(), actual.getFileMode());
    assertEquals("length", expected.getLength(), actual.getLength());
    assertEquals("objectId", expected.getObjectId(), actual.getObjectId());
    assertEquals("stage", expected.getStage(), actual.getStage());
    assertEquals("path", expected.getPathString(), actual.getPathString());
  } catch(AssertionError e) {
    fail(header + "caches first differed at entry [" + index + "]; " + e.getMessage());
  }
}
 
Example #29
Source File: GitPushWindow.java    From XACML with MIT License 5 votes vote down vote up
protected Object generateUntrackedEntry(final GitEntry entry) {
	Button add = new Button("Add");
	add.setImmediate(true);
	add.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				DirCache cache = self.git.add().addFilepattern(entry.getName()).call();
				DirCacheEntry cacheEntry = cache.getEntry(entry.getName());
				assert(cacheEntry != null);
				if (cacheEntry == null) {
					return;
				}
				if (cacheEntry.isMerged()) {
					self.refreshStatus();
				}
			} catch (GitAPIException e) {
				String error = "Failed to add: " + e.getLocalizedMessage();
				logger.error(error);
				AdminNotification.error(error);
			}
		}
	});
	return add;
}
 
Example #30
Source File: GitManagerImpl.java    From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public ConflictFile queryConflictFile(Workspace ws, String path, boolean base64) throws Exception {
    GitStatus status = status(ws, ws.getRelativePath(path));

    String relativePath = ws.getRelativePath(path).toString();

    if (!status.equals(GitStatus.CONFLICTION)) {
        throw new GitOperationException(format("status of %s is not confliction", path));
    }

    String basePath = path + CONFLIX_FILE_BASE_SUFFIX;
    String localPath = path + CONFLIX_FILE_LOCAL_SUFFIX;
    String remotePath = path + CONFLIX_FILE_REMOTE_SUFFIX;

    if (!ws.exists(basePath)
            || !ws.exists(localPath)
            || !ws.exists(remotePath)) {
        Repository repository = getRepository(ws.getSpaceKey());

        DirCacheEntry[] entries = findEntrys(repository, relativePath);

        ObjectId local = null, remote = null, base = null;

        for (DirCacheEntry entry : entries) {
            if (entry.getStage() == DirCacheEntry.STAGE_1) base = entry.getObjectId();
            else if (entry.getStage() == DirCacheEntry.STAGE_2) local = entry.getObjectId();
            else if (entry.getStage() == DirCacheEntry.STAGE_3) remote = entry.getObjectId();
        }

        generate_conflict_files(ws, base, local, remote, path);
    }

    ConflictFile response = new ConflictFile();

    response.setBase(ws.read(basePath, ws.getEncoding(), base64));
    response.setLocal(ws.read(localPath, ws.getEncoding(), base64));
    response.setRemote(ws.read(remotePath, ws.getEncoding(), base64));

    return response;
}