[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[jgit-dev] Creating the equivalent of "git diff"
- From: Zach Oakes <zsoakes@xxxxxxxxx>
- Date: Mon, 15 Sep 2014 00:50:43 -0400
- Delivered-to: firstname.lastname@example.org
I'm trying to make an exact equivalent to the plain "git diff" command programmatically. The only remaining issue is that it doesn't seem to be respecting the repository's gitignore file. I am getting numerous diffs for files in a build directory, which do not appear when I run it on the command line. I would appreciate help if anyone can provide it.
DirCacheIterator dci = new DirCacheIterator(repo.readDirCache());
FileTreeIterator fti = new FileTreeIterator(repo);
ByteArrayOutputStream out = new ByteArrayOutputStream();
DiffFormatter df = new DiffFormatter(out);
List<DiffEntry> entries = df.scan(dci, fti);