Originally forked from spearce's JGit