Disposing repository after fetch operation doesn't seem to free all files. Tested on windows using latest package from nuget.
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testrepo");
using (var repo = new Repository(Repository.Init(path, isBare: true)))
{
var remote = repo.Network.Remotes.Add("origin", "https://github.com/libgit2/TestGitRepository.git", "+refs/*:refs/*");
repo.Network.Fetch(remote);
repo.Network.Remotes.Remove("origin");
}
Directory.Delete(path, true);
System.UnauthorizedAccessException was unhandled
HResult=-2147024891
Message=Access to the path 'pack-773b425dab536d28aaeaf2b8f310c9c25f256087.idx' is denied.
Source=mscorlib
StackTrace:
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
at System.IO.Directory.Delete(String path, Boolean recursive)
at ConsoleApplication1.Program.Main(String[] args) in c:\Users\Lukáš\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 24
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Disposing repository after fetch operation doesn't seem to free all files. Tested on windows using latest package from nuget.