Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » org.eclipse.jgit.errors.MissingObjectException: Missing blob
org.eclipse.jgit.errors.MissingObjectException: Missing blob [message #768095] Mon, 19 December 2011 10:16 Go to next message
Victor Roldan Betancort is currently offline Victor Roldan Betancort
Messages: 524
Registered: July 2009
Senior Member
Hi guys,

i'm creating a UI contribution to Git repositories view that creates a
diff patch for a repository. Pretty much what i want to achieve is the
same as executing "git diff > myPatch.patch".

My code is looking like this:

FileDialog dialog = new FileDialog(part.getSite().getShell(), SWT.SINGLE
| SWT.SAVE);
String fileName = dialog.open();

if (repository != null && fileName != null) {
Git git = new Git(repository);
DiffCommand diffCommand = git.diff();
try
{
List<DiffEntry> diffEntries = diffCommand.call();
FileOutputStream outputStream = new FileOutputStream(new
File(dialog.getFileName()));

DiffFormatter formatter = new DiffFormatter(outputStream);
formatter.setRepository(repository);
formatter.format(diffEntries);
outputStream.flush();
outputStream.close();
}
catch (GitAPIException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}


However, I always get the same exception when executing
DiffFormatter.format(List<DiffEntry>):


org.eclipse.jgit.errors.MissingObjectException: Missing blob
5446adf9bedfed0680b6a44b7d4f19b5c8f8fa86
at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:126)
at
org.eclipse.jgit.diff.ContentSource$ObjectReaderSource.open(ContentSource.java:146)
at org.eclipse.jgit.diff.ContentSource$Pair.open(ContentSource.java:331)
at org.eclipse.jgit.diff.DiffFormatter.open(DiffFormatter.java:967)
at
org.eclipse.jgit.diff.DiffFormatter.createFormatResult(DiffFormatter.java:894)
at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:607)
at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:594)
at
org.eclipse.emf.cdo.releng.git.patch.CreateDiffPatchAction.run(CreateDiffPatchAction.java:43)
....

Any clue what could be going on?

Cheers!
Víctor.
Re: org.eclipse.jgit.errors.MissingObjectException: Missing blob [message #768103 is a reply to message #768095] Mon, 19 December 2011 10:19 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan Betancort
Messages: 524
Registered: July 2009
Senior Member
I forgot to mention that I'm using JGit 1.1.0.201109151100!
Re: org.eclipse.jgit.errors.MissingObjectException: Missing blob [message #768106 is a reply to message #768103] Mon, 19 December 2011 10:27 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan Betancort
Messages: 524
Registered: July 2009
Senior Member
Also, I get the same exception with nightly builds (1.2.0).
Re: org.eclipse.jgit.errors.MissingObjectException: Missing blob [message #775122 is a reply to message #768095] Thu, 05 January 2012 06:20 Go to previous message
Victor Roldan Betancort is currently offline Victor Roldan Betancort
Messages: 524
Registered: July 2009
Senior Member
Ping?

Víctor Roldán Betancort escribió:
> Hi guys,
>
> i'm creating a UI contribution to Git repositories view that creates a
> diff patch for a repository. Pretty much what i want to achieve is the
> same as executing "git diff > myPatch.patch".
>
> My code is looking like this:
>
> FileDialog dialog = new FileDialog(part.getSite().getShell(), SWT.SINGLE
> | SWT.SAVE);
> String fileName = dialog.open();
>
> if (repository != null && fileName != null) {
> Git git = new Git(repository);
> DiffCommand diffCommand = git.diff();
> try
> {
> List<DiffEntry> diffEntries = diffCommand.call();
> FileOutputStream outputStream = new FileOutputStream(new
> File(dialog.getFileName()));
>
> DiffFormatter formatter = new DiffFormatter(outputStream);
> formatter.setRepository(repository);
> formatter.format(diffEntries);
> outputStream.flush();
> outputStream.close();
> }
> catch (GitAPIException e)
> {
> e.printStackTrace();
> }
> catch (IOException e)
> {
> e.printStackTrace();
> }
> }
>
>
> However, I always get the same exception when executing
> DiffFormatter.format(List<DiffEntry>):
>
>
> org.eclipse.jgit.errors.MissingObjectException: Missing blob
> 5446adf9bedfed0680b6a44b7d4f19b5c8f8fa86
> at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:126)
> at
> org.eclipse.jgit.diff.ContentSource$ObjectReaderSource.open(ContentSource.java:146)
>
> at org.eclipse.jgit.diff.ContentSource$Pair.open(ContentSource.java:331)
> at org.eclipse.jgit.diff.DiffFormatter.open(DiffFormatter.java:967)
> at
> org.eclipse.jgit.diff.DiffFormatter.createFormatResult(DiffFormatter.java:894)
>
> at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:607)
> at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:594)
> at
> org.eclipse.emf.cdo.releng.git.patch.CreateDiffPatchAction.run(CreateDiffPatchAction.java:43)
>
> ...
>
> Any clue what could be going on?
>
> Cheers!
> Víctor.
Previous Topic:Synchronize view shows non-existent white-space and other outgoing changes
Next Topic:Exception caught during execution of fetch command
Goto Forum:
  


Current Time: Sat Aug 30 10:38:16 EDT 2014

Powered by FUDForum. Page generated in 0.04171 seconds