fail("didn't get the expected exception");
} catch (CheckoutConflictException e) {
assertConflict("foo");
+ assertEquals("foo", e.getConflictingFiles()[0]);
assertWorkDir(mkmap("foo", "bar", "other", "other"));
assertIndex(mk("other"));
}
assertWorkDir(mkmap("a", "a", "b/c", "b/c", "d", "d", "e/f",
"e/f", "e/g", "e/g3"));
assertConflict("e/g");
+ assertEquals("e/g", e.getConflictingFiles()[0]);
}
}
public class CheckoutConflictException extends IOException {
private static final long serialVersionUID = 1L;
+ private final String[] conflicting;
+
/**
* Construct a CheckoutConflictException for the specified file
*
*/
public CheckoutConflictException(String file) {
super(MessageFormat.format(JGitText.get().checkoutConflictWithFile, file));
+ conflicting = new String[] { file };
}
/**
*/
public CheckoutConflictException(String[] files) {
super(MessageFormat.format(JGitText.get().checkoutConflictWithFiles, buildList(files)));
+ conflicting = files;
+ }
+
+ /**
+ * @return the relative paths of the conflicting files (relative to the
+ * working directory root).
+ * @since 4.4
+ */
+ public String[] getConflictingFiles() {
+ return conflicting;
}
private static String buildList(String[] files) {