final String SOURCE_FILE_CONTENTS = "Source change";
final String NEW_FILE_CONTENTS = "New file from target";
// make sure the config for target says we should pull with merge
// we will override this later with the setRebase method
StoredConfig targetConfig = dbTarget.getConfig();
targetConfig.setBoolean("branch", "master", "rebase", false);
targetConfig.save();
// create commit in source
writeToFile(sourceFile, SOURCE_FILE_CONTENTS);
source.add().addFilepattern(sourceFile.getName()).call();
source.commit().setMessage(SOURCE_COMMIT_MESSAGE).call();
// create commit in target, not conflicting with the new commit in source
File newFile = new File(dbTarget.getWorkTree().getPath() + "/newFile.txt");
writeToFile(newFile, NEW_FILE_CONTENTS);
target.add().addFilepattern(newFile.getName()).call();
target.commit().setMessage(TARGET_COMMIT_MESSAGE).call();
// verify that rebase is set to false in the config
assertFalse(targetConfig.getBoolean("branch", "master", "rebase", true));
// pull with rebase - local commit in target should be on top
PullResult pullResult = target.pull().setRebase(true).call();
// make sure pull is considered successful