{"action":"created","comment":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/28270044","id":28270044,"diff_hunk":"@@ -0,0 +1,54 @@\n+﻿using System;\n+using System.Collections.Generic;\n+\n+namespace LibGit2Sharp\n+{\n+    /// <summary>\n+    /// Criteria used to order the commits of the repository when querying its history.\n+    /// </summary>\n+    public sealed class FollowFilter\n+    {\n+        private static readonly List<CommitSortStrategies> AllowedSortStrategies = new List<CommitSortStrategies>\n+        {\n+            CommitSortStrategies.Topological,\n+            CommitSortStrategies.Time,\n+            CommitSortStrategies.Topological | CommitSortStrategies.Time\n+        };\n+\n+        private CommitSortStrategies _sortBy;\n+\n+        /// <summary>\n+        /// Initializes a new instance of <see cref=\"FollowFilter\" />.\n+        /// </summary>\n+        public FollowFilter()\n+        {\n+            SortBy = CommitSortStrategies.Time;\n+        }\n+\n+        /// <summary>\n+        /// The ordering stragtegy to use.\n+        /// <para>\n+        /// By default, the commits are shown in reverse chronological order.\n+        /// </para>\n+        /// <para>\n+        /// Only 'Topological', 'Time', or 'Topological | Time' are allowed.\n+        /// </para>\n+        /// </summary>\n+        public CommitSortStrategies SortBy\n+        {\n+            get { return _sortBy; }\n+\n+            set\n+            {\n+                if (!AllowedSortStrategies.Contains(value))","path":"LibGit2Sharp/FollowFilter.cs","position":43,"original_position":43,"commit_id":"f2039b371b67006a6a58dc9c47be0ba4eaa5a55b","original_commit_id":"f2039b371b67006a6a58dc9c47be0ba4eaa5a55b","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},"body":"And by the way, I would be with you if we talked about using ```CommitFilter``` or any other class that is more generic than ```FollowFilter```. But the sole purpose of ```FollowFilter```, from my perspective, is to represent a consistent and valid filter for the purposes of following a file's history.","created_at":"2015-04-13T19:21:47Z","updated_at":"2015-04-13T19:21:47Z","html_url":"https://github.com/libgit2/libgit2sharp/pull/963#discussion_r28270044","pull_request_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963","_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/28270044"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/963#discussion_r28270044"},"pull_request":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963"}}},"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963","id":29410960,"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","issue_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963","number":963,"state":"open","locked":false,"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},"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```","created_at":"2015-02-17T00:58:03Z","updated_at":"2015-04-13T19:21:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cfbf7cb4abd3a4ec58370d54801cb619834f177b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963/commits","review_comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963/comments","review_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963/comments","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/f2039b371b67006a6a58dc9c47be0ba4eaa5a55b","head":{"label":"ThomasBarnekow:file-history","ref":"file-history","sha":"f2039b371b67006a6a58dc9c47be0ba4eaa5a55b","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},"repo":{"id":27309232,"name":"libgit2sharp","full_name":"ThomasBarnekow/libgit2sharp","owner":{"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},"private":false,"html_url":"https://github.com/ThomasBarnekow/libgit2sharp","description":"Git + .Net/Mono = ❤","fork":true,"url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp","forks_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/forks","keys_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/teams","hooks_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/hooks","issue_events_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/issues/events{/number}","events_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/events","assignees_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/assignees{/user}","branches_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/branches{/branch}","tags_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/tags","blobs_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/languages","stargazers_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/stargazers","contributors_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/contributors","subscribers_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/subscribers","subscription_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/subscription","commits_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/contents/{+path}","compare_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/merges","archive_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/downloads","issues_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/issues{/number}","pulls_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/labels{/name}","releases_url":"https://api.github.com/repos/ThomasBarnekow/libgit2sharp/releases{/id}","created_at":"2014-11-29T17:15:57Z","updated_at":"2015-03-19T22:26:25Z","pushed_at":"2015-04-12T22:00:43Z","git_url":"git://github.com/ThomasBarnekow/libgit2sharp.git","ssh_url":"git@github.com:ThomasBarnekow/libgit2sharp.git","clone_url":"https://github.com/ThomasBarnekow/libgit2sharp.git","svn_url":"https://github.com/ThomasBarnekow/libgit2sharp","homepage":"http://libgit2.github.com","size":147070,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"vNext"}},"base":{"label":"libgit2:vNext","ref":"vNext","sha":"cad89d0814481252a70a811c0fb5daecc8b8b745","user":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=3","gravatar_id":"","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"repo":{"id":1415168,"name":"libgit2sharp","full_name":"libgit2/libgit2sharp","owner":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=3","gravatar_id":"","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgit2/libgit2sharp","description":"Git + .Net/Mono = ❤","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2sharp","forks_url":"https://api.github.com/repos/libgit2/libgit2sharp/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2sharp/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2sharp/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2sharp/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2sharp/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2sharp/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2sharp/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2sharp/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2sharp/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/libgit2/libgit2sharp/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2sharp/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2sharp/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2sharp/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2sharp/releases{/id}","created_at":"2011-02-26T16:44:49Z","updated_at":"2015-04-12T11:15:21Z","pushed_at":"2015-04-13T17:17:59Z","git_url":"git://github.com/libgit2/libgit2sharp.git","ssh_url":"git@github.com:libgit2/libgit2sharp.git","clone_url":"https://github.com/libgit2/libgit2sharp.git","svn_url":"https://github.com/libgit2/libgit2sharp","homepage":"http://libgit2.github.com","size":237013,"stargazers_count":753,"watchers_count":753,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":302,"mirror_url":null,"open_issues_count":137,"forks":302,"open_issues":137,"watchers":753,"default_branch":"vNext"}},"_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/963"},"issue":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963"},"comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/963/comments"},"review_comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963/comments"},"review_comment":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/963/commits"},"statuses":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/f2039b371b67006a6a58dc9c47be0ba4eaa5a55b"}}}}