Git index locking problem [message #1727357] |
Tue, 22 March 2016 08:05  |
Eclipse User |
|
|
|
Hi!
My scenario in my java program is the following:
1. Two users in parallel commit a file and doing a push.
2. Method is synchronized.
3. Code:
synchronized(getSynchroForRepo(rootRepoDir)) {
File file = new File(rootRepoDir, listDefinitionName);
writeFile(file, xmlDef.getBytes());
try {
git.add().addFilepattern(listDefinitionName).call();
CommitCommand commit = git.commit();
commit.setMessage("Commit file: "+listDefinitionName).call();
GitPush();
}
Unfortunately I get the exception (addFilepattern line above):
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of add command
at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:242)
...
Caused by: org.eclipse.jgit.errors.LockFailedException: Cannot lock C:\RepoGit\.git\index
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:250)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:327)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:293)
at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:1158)
at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:147)
... 30 more
If anybody had any idea what I'm doing wrong I'd appreciate it!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05922 seconds