Hello, I'm trying to list all the line modified in a git repository using jgit.
I created a simple maven project "Test", ran:
git init
git add src/*
git commit -am "first commit"
And then finally did a simple code modification to have an output when running
From an other Java project, I run the following code, in order to list the lines modified in the "Test" project.
repository = new FileRepositoryBuilder().setGitDir(/* Test project .git file */).build();
Git git = new Git(repository);
List<DiffEntry> entries = git.diff().call();
DiffFormatter diffFormatter = new DiffFormatter(System.out);
diffFormatter.setRepository(repository);
diffFormatter.toFileHeader(entries.get(0));
Nonetheless I only obtain the following error:
org.eclipse.jgit.errors.MissingObjectException: Missing blob 07c5f824f6b780ee405823f793248846a0e9e11e
at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:164)
at org.eclipse.jgit.diff.ContentSource$ObjectReaderSource.open(ContentSource.java:144)
at org.eclipse.jgit.diff.ContentSource$Pair.open(ContentSource.java:280)
at org.eclipse.jgit.diff.DiffFormatter.open(DiffFormatter.java:1040)
at org.eclipse.jgit.diff.DiffFormatter.createFormatResult(DiffFormatter.java:968)
at org.eclipse.jgit.diff.DiffFormatter.toFileHeader(DiffFormatter.java:933)
My git deposit is quite simple, thus I don't understand what is wrong in my code. Tell me if you need more informations.
Best regards,
Thibault
[Updated on: Tue, 30 May 2017 13:41]
Report message to a moderator