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

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) {
		public void apply(DirCacheEntry ent) {
			ent.setFileMode(repo.getFS().canExecute(file) ? FileMode.EXECUTABLE_FILE
					: FileMode.REGULAR_FILE);
			ent.setLength((int) file.length());
} catch (RuntimeException e) {
	throw e;


Back to the top