JGit frequently throws jgit.errors.MissingObjectException: Missing commit while merging [message #655815] |
Tue, 22 February 2011 12:13  |
Eclipse User |
|
|
|
Hello,
I am trying to reproduce the following exception:
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of merge command. org.eclipse.
jgit.errors.MissingObjectException: Missing commit d8cce2103d8e36d0d924d93f1ac6b882c10b9a20
at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:220)
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:255)
It happens frequently, and I don't understand why the fetching would miss that objectId.
When that exception occurs, I went to native git, and ran "git status"
$ git status
fatal: bad object HEAD
Then I wanted to read the tree to see if it is valid:
$ git read-tree HEAD
fatal: failed to unpack tree object HEAD
The only way to fix this, is to "git pull" from native git, pulling from JGit always throws the above exception:
$ git pull
error: refs/heads/master does not point to a valid object!
error: refs/remotes/origin/master does not point to a valid object!
error: refs/heads/master does not point to a valid object!
error: refs/remotes/origin/master does not point to a valid object!
error: refs/heads/master does not point to a valid object!
error: refs/remotes/origin/master does not point to a valid object!
error: refs/heads/master does not point to a valid object!
error: refs/remotes/origin/master does not point to a valid object!
remote: Counting objects: 1684, done.
remote: Compressing objects: 100% (1128/1128), done.
remote: Total 1684 (delta 452), reused 1453 (delta 376)
Receiving objects: 100% (1684/1684), 232.59 KiB, done.
Resolving deltas: 100% (452/452), done.
From localhost:/test
* [new branch] master -> origin/master
Already up-to-date.
The missing commit comes back to life. The only way for me to recover is from native git.
$ git status
# On branch master
nothing to commit (working directory clean)
Any ideas how to solve this issue? All I am doing in JGit is:
It works usually, but frequently (once per day) the whole repository goes in lock mode and I can't use JGit anymore, I would have to resort to "git pull" in native Git to make it function again.
Thanks!
|
|
|
|
Re: JGit frequently throws jgit.errors.MissingObjectException: Missing commit while merging [message #655975 is a reply to message #655950] |
Wed, 23 February 2011 10:36   |
Eclipse User |
|
|
|
Hi Matthias,
git fsck returns nothing. (I already recovered using native git).
Right now, my short term solution is to fall back to native git pull instead of JGit pull:
public boolean refresh() {
boolean status = false;
try {
git.pull().call();
status = true;
}
catch (JGitInternalException e) {
if (e.getCause() instanceof MissingObjectException) {
log.error("JGit Error occurred, trying to recover with Native Git");
// Lets attempt and recover using Native Git. Something went
// wrong using JGit Merge.
status = nativeRefresh();
} else {
log.error("JGit Error recovery failed. " + e.getMessage(), e);
}
}
catch (GitAPIException e) {
log.error("Cannot find Git repository. " + e.getMessage(), e);
}
return status;
}
private boolean nativeRefresh() {
boolean status = false;
String[] commandLine = new String[] {
"c:/Git/bin/sh.exe",
"--login",
"-i",
"-c",
"git pull"
};
ProcessBuilder pb = new ProcessBuilder(commandLine);
pb.directory(new File("C:/repo/"));
pb.redirectErrorStream(true);
try {
Process p = pb.start();
status = p.waitFor() == 0 ? true : false;
p.destroy();
} catch (IOException e) {
log.error("Git pull process cannot successfully start. ", e);
} catch (InterruptedException e) {
log.error("Something went wrong waiting for Git pull to complete", e);
}
return status;
}
What do you recommend me to do next to help solve this issue? The git repo is linear, and JGit is the only one pushing to it no one else. No branches are being made, everything is done in Master.
Thanks in advance.
[Updated on: Wed, 23 February 2011 10:38] by Moderator
|
|
|
|
|
|
|
Re: JGit frequently throws jgit.errors.MissingObjectException: Missing commit while merging [message #1125226 is a reply to message #655815] |
Fri, 04 October 2013 05:35  |
Eclipse User |
|
|
|
Hi ,
Me using JGIT jars 1)org.eclipse.egit.github.core-2.0.4.jar and 2)org.eclipse.jgit-2.3.1.201302201838-r for a Java project.
While i am trying to retrive the file version from Repository(i.e. a physical directory on my computer file system ).
I am getting the below error:
13:12:10,268 INFO [STDOUT] nothing fouind
13:12:10,283 ERROR [STDERR] org.eclipse.jgit.errors.MissingObjectException: Missing unknown 0000000000000000000000000000000000000000
13:12:10,283 ERROR [STDERR] at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:125)
13:12:10,283 ERROR [STDERR] at org.eclipse.jgit.lib.ObjectDatabase.open(ObjectDatabase.java:176)
13:12:10,283 ERROR [STDERR] at org.eclipse.jgit.lib.ObjectDatabase.open(ObjectDatabase.java:147)
13:12:10,283 ERROR [STDERR] at org.eclipse.jgit.lib.Repository.open(Repository.java:243)
Could anyone help me how to recover from this error.
I would be very happy if you provide any Java fix.
Thank you.
shasu
|
|
|
Powered by
FUDForum. Page generated in 0.05530 seconds