Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » org.eclipse.jgit.errors.MissingObjectException: Missing blob
org.eclipse.jgit.errors.MissingObjectException: Missing blob [message #768095] Mon, 19 December 2011 15:16 Go to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
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 15:19 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
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 15:27 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
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 11:20 Go to previous message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
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:NPE in decorator
Next Topic:Exception caught during execution of fetch command
Goto Forum:
  


Current Time: Thu Apr 25 05:55:35 GMT 2024

Powered by FUDForum. Page generated in 0.03305 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top