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

Darn. This is what happens when you don't read the days messages in time order ...

Sent from my iPhone 5

> On 19 Sep 2014, at 19:54, Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:
> 
> It's most likely not the pack files but a leftover file reference you have on the extracted contents. When windows has a process that opens a file it will lock it and prevent renaming/deleting/changing. Only when the file is closed can you rename it. 
> 
> This doesn't occur on other operating systems though so you won't see it. 
> 
> I would expect something is holding open your pom. If you're doing it in an eclipse workspace it may be eclipse itself that is noticing the file and opening it for reading. 
> 
> Alex
> 
> Sent from my iPhone 5
> 
>> On 19 Sep 2014, at 15:57, "Andrey Loskutov" <loskutov@xxxxxx> wrote:
>> 
>> Hi,
>> 
>> I've observed not the same but similar issue during tests on Linux NFS mount, where jgit was not (always) cleaning up the opened temporary pack file streams, see [1] for more details.
>> 
>> I didn't found the root cause however. I suspect that if you would add some delay between two checkout calls your issue would disappear, because this was what I've observed in debugger.
>> 
>> [1] https://git.eclipse.org/r/#/c/30328/
>> 
>> Kind regards,
>> Andrey Loskutov
>> 
>> http://google.com/+AndreyLoskutov
>> 
>> 
>>> Gesendet: Freitag, 19. September 2014 um 16:39 Uhr
>>> Von: "Sascha Vogt" <sascha.vogt@xxxxxxxxx>
>>> An: jgit-dev@xxxxxxxxxxx
>>> Betreff: [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-
>> _______________________________________________
>> jgit-dev mailing list
>> jgit-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jgit-dev