This implementation is too complicated and uses too many low level JGit features.

You can use the API log command instead, once for the incoming and once for the outgoing changes:

Git git = new Git(repo);
it = git.log().addRange(ancestorCommit, srcRev).call().iterator() 
...