Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Diff between working directory and commit


I've been trying to find a way to build a diff between the current
working directory (unstaged items) and a certain commit.

In git this seems trivial by adding just saying which commit, but in
jgit i'm lost. This is what I have:

// diff of working directory with last commit
ByteArrayOutputStream out = new ByteArrayOutputStream();
DiffFormatter df = new DiffFormatter(out);
DirCacheIterator oldTree = new
FileTreeIterator newTree = new FileTreeIterator(repository);
df.format(oldTree, newTree);
System.out.println("Diff:\n" + out.toString() + "\n\n");

and building a diff when i have two objectIds is trivial.

What am I mising?

Kind regards
Robert von Burg <eitch@xxxxxxxxxxx>
dipl. Informatiker in Softwareentwicklung HF / pBac-Eng ODEC
software development
system & network administration

Back to the top