Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] JGit checkout of multiple tags fails with "Could not rename file"

Hi all,

since a few days I'm banging my head against a (JGit) wall ;) Maybe
somebody here understands my issue.

I'm trying to checkout a few tags one after another (to archive some
source code), but switching from one tag to another gives a strange
"Could not rename file" JGitInternalException.

Basically what I want to do (in cmd line commands):
1. git clone <url>
2. git checkout -b <tag-1> <tag-1>
3. git checkout -b <tag-2> <tag-2>

On cmd line this works, in JGit I'm using the following commands:

Git.cloneRepository()
           .setURI(url)
           .setCredentialsProvider(getCredentialsProvider())
           .setDirectory(tmpDir)
           .call();

git.checkout()
    .setName("tag-1")
    .setCreateBranch(true)
    .setForce(true)
    .call();

git.checkout()
    .setName("tag-2")
    .setCreateBranch(true)
    .setForce(true)
    .call();

The error I'm getting (full stack at the end of the mail):
org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file
D:\dev\tmp\unit-test\git\base\common\locator\._pom.xml6206658336832583616.tmp
to D:\dev\tmp\unit-test\git\base\common\locator\pom.xml

Strange thing: It doesn't fail always, but around 90-95% of the time.
Also I'm on Windows as the path above suggests ;) TortoiseGit is
installed but I have disabled the TGitCache process. Also no explorer
was open on the used directory.

I also did git status commands in between checkouts -> no changed files.

I did also insert a git.clean().setCleanDirectories(true).call() and
git.reset().setRef("HEAD").setMode(ResetType.HARD).call() between
checkouts, no differences.

I tried JGit 2.3.1, 3.2, 3.4.1 and 3.5.0-rc1, also no differences.

When I check the state after such a failed checkout of tag-2 I'm seeing:

"git status":
HEAD detached at ef1edf8
nothing to commit, working directory clean

"git branch" gives:
* (detached from ef1edf8)
  tag-1
  tag-2
  master

Has anybody any idea? I've no idea where to search next.

Greetings
-Sascha-

Full stacktrace:

org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file
D:\dev\tmp\unit-test\git\base\common\locator\._pom.xml6206658336832583616.tmp
to D:\dev\tmp\unit-test\git\base\common\locator\pom.xml
	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:315)
	at
com.seeburger.buildtools.sourcedeposit.scm.GitHandler.checkout(GitHandler.java:130)
	at
com.seeburger.buildtools.sourcedeposit.scm.GitHandler.checkout(GitHandler.java:107)
	at
com.seeburger.buildtools.sourcedeposit.scm.GitHandlerTest.testCheckoutWithSwitch(GitHandlerTest.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.io.IOException: Could not rename file
D:\dev\tmp\unit-test\git\base\common\locator\._pom.xml6206658336832583616.tmp
to D:\dev\tmp\unit-test\git\base\common\locator\pom.xml
	at
org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1232)
	at
org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:459)
	at
org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:394)
	at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:258)
	... 27 more


Back to the top