Comments (12)
What version of ngit are you using? Is it the very latest commit in master?
from ngit.
Yes i've pulled from here on my recent builds and the problem is definitely there.. If I do a simple clone, and then try and recursively delete the folder i've cloned into a few seconds later (even 10 second later) the files are locked.
from ngit.
Any update to this? I still can't delete the cloned directory within a short timespan
from ngit.
Try this:
var repoPath = "C:\\otherrepopath";
var checkoutDir = "C:\\output";
var cmd = Git.CloneRepository();
cmd.SetDirectory(checkoutDir);
cmd.SetURI(repoPath);
var git = cmd.Call();
git.Checkout().SetName("master").Call();
Directory.Delete(checkoutDir,true);
am I missing something? the IDX will be locked.
calling GetRespository().Close()
doesn't appear help.
from ngit.
This is also mentioned in a number of jGit posts:
http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg01951.html
http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg01954.html
I've tested by even ReposityCache.Close(repo)
until the useCnt drops to -1 and the file is still locked.
This seems to be a breaking issue with NGit.
from ngit.
Yeah. JGit is broken in that regard. I haven't managed to find a high level fix, so that means we're stuck with waiting for the JGit team to fix it.
from ngit.
Could you try forcing a few GC collections? Try doing it at least 3 times.
from ngit.
Are there any hacks I can do to release the file handle?
from ngit.
I've tried setting FileAttributes to normal, but it didn't cut it.
from ngit.
Yeah I've also tried to recommended FileUtils.Delete(checkoutDir, FileUtils.RECURSIVE | FileUtils.RETRY);
the jGit guys are using with no luck.
many rounds of GC.Collect
do nothing. There is a stream or file handle left open. Am trying to open the solution locally to start debugging the lock, but don't have SharpZipLib
,Mono.Posix
or Mono.Security
.
Where can I grab these?
from ngit.
I have found a way to clear all of the file handles. You need to really be specific about your releases.
original example:
var repoPath = "C:\\otherrepopath";
var checkoutDir = "C:\\output";
var cmd = Git.CloneRepository();
cmd.SetDirectory(checkoutDir);
cmd.SetURI(repoPath);
var git = cmd.Call();
git.Checkout().SetName("master").Call();
Directory.Delete(checkoutDir,true);
New version without file locks:
var repoPath = "C:\\otherrepopath";
var checkoutDir = "C:\\output";
var cmd = Git.CloneRepository();
cmd.SetDirectory(checkoutDir);
cmd.SetURI(repoPath);
var git = cmd.Call();
var gitCheckout = git.Checkout().SetName("master").Call(); //assign the return to capture the handle
gitCheckout.GetRepository().Close(); //release the handle
git.GetRepository().Close(); // release the first handle
Directory.Delete(checkoutDir,true);
from ngit.
I find that the fluent API makes it very easy to lose track of references and file handles made between fluent calls.
This seems to be a serious issue with Ngit that should be addressed whereby if being called through the fluent API, previous references should be closed in consecutive calls.
from ngit.
Related Issues (20)
- Cached RmCommand unavailable
- Clone, Fetch, Push documentation / examples HOT 1
- Basic authentication when cloning with http/https
- Cannot add HEAD to a bundle HOT 1
- Incorrect topological sorting HOT 1
- Ngit CredentialProvider - Keypair HOT 1
- Nsch - generating RSA key fails with casting exception HOT 1
- Compatibility issues with latest SharpZipLib
- Exception / hang on Mono.Security Diffie-Helman key generation for SSH Transport
- Cloning works on IISExpress but fails on normal IIS.
- IsClean() HOT 1
- Diff is duplicated
- CopyOnWriteArrayList is dangerously broken
- Code is outdated HOT 7
- Outdated ciphers for using JSch
- Port to NetStandard 2.0
- Object reference not set to an instance of an object.
- A secure connection could not be established
- Algorithm negotiation fail
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngit.