{"action":"created","issue":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963","labels_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963/labels{/name}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963/comments","events_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963/events","html_url":"https://github.com/libgit2/libgit2sharp/pull/963","id":57870551,"number":963,"title":"FileHistory Feature","user":{"login":"ThomasBarnekow","id":8481516,"avatar_url":"https://avatars.githubusercontent.com/u/8481516?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasBarnekow","html_url":"https://github.com/ThomasBarnekow","followers_url":"https://api.github.com/users/ThomasBarnekow/followers","following_url":"https://api.github.com/users/ThomasBarnekow/following{/other_user}","gists_url":"https://api.github.com/users/ThomasBarnekow/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasBarnekow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasBarnekow/subscriptions","organizations_url":"https://api.github.com/users/ThomasBarnekow/orgs","repos_url":"https://api.github.com/users/ThomasBarnekow/repos","events_url":"https://api.github.com/users/ThomasBarnekow/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasBarnekow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-17T00:58:03Z","updated_at":"2015-02-17T15:06:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963","html_url":"https://github.com/libgit2/libgit2sharp/pull/963","diff_url":"https://github.com/libgit2/libgit2sharp/pull/963.diff","patch_url":"https://github.com/libgit2/libgit2sharp/pull/963.patch"},"body":"Based on my research, this feature was discussed in the past but I could not find the functionality in libgit2sharp. As I needed it as well, I implemented it and would like to share it.\r\n\r\nThe ```FileHistory``` class provides a history of commits in which a given file was created, changed, or renamed. Based on that commit history, it also provides the collection of Blobs representing a change of the file's contents, i.e., ignoring renames.\r\n\r\nI've also implemented a ```FileHistoryExtensions```class that provides extension methods for the ```Repository```class. These could potentially be moved to the ```RepositoryExtensions```class.\r\n\r\nUsage would be as follows:\r\n\r\n```\r\nusing (Repository repo = new Repository(repoPath))\r\n{\r\n    FileHistory history = repo.GetFileHistory(relativePath);\r\n    IEnumerable<FileHistoryEntry> relevantCommits = history.RelevantCommits();\r\n    IEnumerable<Blob> relevantBlobs = history.RelevantBlobs();\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/comments/74681589","html_url":"https://github.com/libgit2/libgit2sharp/pull/963#issuecomment-74681589","issue_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963","id":74681589,"user":{"login":"ThomasBarnekow","id":8481516,"avatar_url":"https://avatars.githubusercontent.com/u/8481516?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasBarnekow","html_url":"https://github.com/ThomasBarnekow","followers_url":"https://api.github.com/users/ThomasBarnekow/followers","following_url":"https://api.github.com/users/ThomasBarnekow/following{/other_user}","gists_url":"https://api.github.com/users/ThomasBarnekow/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasBarnekow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasBarnekow/subscriptions","organizations_url":"https://api.github.com/users/ThomasBarnekow/orgs","repos_url":"https://api.github.com/users/ThomasBarnekow/repos","events_url":"https://api.github.com/users/ThomasBarnekow/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasBarnekow/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T15:06:11Z","updated_at":"2015-02-17T15:06:11Z","body":"Here's a full stack trace:\r\n\r\n```\r\nLibGit2Sharp.Tests.DiffTreeToTreeFixture.CanCompareTwoVersionsOfAFileWithATrailingNewlineDeletion(contextLines: 4, expectedPatchLength: 193) [FAIL]\r\n   System.IO.IOException : The process cannot access the file 'C:\\Visual Studio 2010\\Projects\\GitHub\\LibGit2Sharp\\LibGit2Sharp.Tests\\bin\\Debug\\TestRepos\\eodajdlt.kwj\\testrepo_wd\\README' because it is being used by another process.\r\n   Stack Trace:\r\n      at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n      at System.IO.File.InternalDelete(String path, Boolean checkHost)\r\n      C:\\Visual Studio 2010\\Projects\\GitHub\\LibGit2Sharp\\LibGit2Sharp.Tests\\TestHelpers\\DirectoryHelper.cs(63,0): at LibGit2Sharp.Tests.TestHelpers.DirectoryHelper.DeleteDirectory(String directoryPath)\r\n      C:\\Visual Studio 2010\\Projects\\GitHub\\LibGit2Sharp\\LibGit2Sharp.Tests\\TestHelpers\\DirectoryHelper.cs(68,0): at LibGit2Sharp.Tests.TestHelpers.DirectoryHelper.DeleteDirectory(String directoryPath)\r\n      C:\\Visual Studio 2010\\Projects\\GitHub\\LibGit2Sharp\\LibGit2Sharp.Tests\\TestHelpers\\BaseFixture.cs(212,0): at LibGit2Sharp.Tests.TestHelpers.BaseFixture.Dispose()\r\n      at Xunit.Sdk.LifetimeCommand.Execute(Object testClass)\r\n      at Xunit.Sdk.ExceptionAndOutputCaptureCommand.Execute(Object testClass)\r\n```\r\nIt is possible, though, that this is related to a local service. I've not found out which one that might be, because I still had 2-3 errors like the one above after deactivating my antivirus and malware services.\r\n\r\nOne further thing I noted is that 42 \"temporary\" folders are left in the TestRepos subdirectory after one test run and a previously empty TestRepos folder. My folder contained a few hundred of these, though. Not sure whether that's expected."}}