Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] RFC: Resolving conflicts using DirCacheEditor

We implemented a new add command in the jgit porcelain API
(http://egit.eclipse.org/r/#change,1036).

We had tried to make use of the DirCacheEditor in case of conflicts but
we failed. (Now we use DirCacheBuilder instead.)

With the code below the new entry was in stage 1 but not in stage 0.
Before the edit there were entries in stage 1, 2 and 3.
Is it possible to use DirCacheEditor to resolve conflicts?

try {
	DirCacheEditor e = dc.editor();
	e.add(new PathEdit(filepath) {
		@Override
		public void apply(DirCacheEntry ent) {
			ent.setFileMode(repo.getFS().canExecute(file) ? FileMode.EXECUTABLE_FILE
					: FileMode.REGULAR_FILE);
			ent.setLastModified(file.lastModified());
			ent.setLength((int) file.length());
			ent.setObjectId(id);
		}
	});
	e.commit();
} catch (RuntimeException e) {
	dc.unlock();
	throw e;
}


Stefan



Back to the top