Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Unable to delete .pack file from submodule git folder
Unable to delete .pack file from submodule git folder [message #1848405] Wed, 01 December 2021 06:20 Go to next message
Eclipse UserFriend
Hello,

I have an Eclipse RCP application that uses JGit to implement a feature of adding and removing submodules in a project.

I have a problem while deleting any submodule after committing it to a repo as there is a .pack file locked by JGit and couldn't be removed until closing Eclipse itself.

These are the steps:
1- Adding any submodule to the project using JGit
2- Then committing it to repo.
3- Restart Eclipse.
4- Try to delete the submodule (submodule path + submodule .git path )

Here the problem happens, the file "objects\pack\pack-39b5080848e019a9377ff2a8c1ab4853b76ba739.pack" for example couldn't be deleted.

Note:
- The problem happens when restarting Eclipse after addition.
- All Git objects are closed as we restarted Eclipse and no Git operation done on the start.

Can you please help?

ECLIPSE 2021-06
EGIT 5.12
Windows 10

Thanks
Hossam
Re: Unable to delete .pack file from submodule git folder [message #1848413 is a reply to message #1848405] Wed, 01 December 2021 09:44 Go to previous messageGo to next message
Eclipse UserFriend
SubmoduleAddCommand#call returns the submodule repository. Did you close that ?

Check if its Repository.useCnt is 0 when you expect it to be closed.

RepositoryCache doesn't immediately release cached repositories. You can try to use its close method to explicitly remove a repository from the cache.
Re: Unable to delete .pack file from submodule git folder [message #1848547 is a reply to message #1848413] Tue, 07 December 2021 07:55 Go to previous messageGo to next message
Eclipse UserFriend
Every repository is closed as it's after Eclipse restart directly and I didn't perform any git operation.
I also tested RepositoryCache#close but still the same problem exist.

I noticed something but I don't the impact of it.
The project which I'm using my plugin in, is loaded in the Project explorer and also in the window "Git Repositories" which means "EGit" uses it and may be it's the cause of locking the file after restarting Eclipse.
could you confirm that or not?
And if it locks the submodule and prevent it form removal, what is the solution?
Re: Unable to delete .pack file from submodule git folder [message #1849003 is a reply to message #1848547] Tue, 28 December 2021 19:46 Go to previous messageGo to next message
Eclipse UserFriend
By default EGit auto-shares git repositories it finds.
You can disable that under "Preferences > Version Control > Git > Projects > Automatically share projects located in a git repository"
Re: Unable to delete .pack file from submodule git folder [message #1849426 is a reply to message #1849003] Wed, 19 January 2022 10:08 Go to previous messageGo to next message
Eclipse UserFriend
How exactly are you trying to delete the file? Note that Java cannot delete read-only files on Windows; you have to set them writeable first.
Re: Unable to delete .pack file from submodule git folder [message #1849802 is a reply to message #1849003] Thu, 03 February 2022 05:52 Go to previous messageGo to next message
Eclipse UserFriend
Matthias Sohn wrote on Wed, 29 December 2021 00:46

By default EGit auto-shares git repositories it finds.
You can disable that under "Preferences > Version Control > Git > Projects > Automatically share projects located in a git repository"


Great, I tried this and it didn't include my project in "Git repository" view when importing the project.
So the files didn't locked by Egit and I could remove them without any problem.

Thank you Matthias ,

Re: Unable to delete .pack file from submodule git folder [message #1849803 is a reply to message #1849426] Thu, 03 February 2022 05:55 Go to previous message
Eclipse UserFriend
Thomas Wolf wrote on Wed, 19 January 2022 15:08

How exactly are you trying to delete the file? Note that Java cannot delete read-only files on Windows; you have to set them writeable first.


Thank you Thomas for you support, the solution prosed by Matthias worked fine with me and fixed my problem
Previous Topic:[Feature request] Show commit message in Revision Information
Next Topic:How to implement a breadth-first rev walker to find closest branch for HEAD
Goto Forum:
  


Current Time: Sun May 18 23:02:02 EDT 2025

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

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

Back to the top