{"action":"created","comment":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/24293195","id":24293195,"diff_hunk":"@@ -0,0 +1,58 @@\n+using System.Collections.Generic;\n+using System.IO;\n+using System.Linq;\n+using System.Text;\n+using LibGit2Sharp.Core;\n+\n+namespace LibGit2Sharp.Tests.TestHelpers\n+{\n+    public class SubstitutionCipherFilter : Filter\n+    {\n+        public int CheckCalledCount = 0;\n+        public int CleanCalledCount = 0;\n+        public int SmudgeCalledCount = 0;\n+\n+        public SubstitutionCipherFilter(string name, string attributes)\n+            : base(name, attributes)\n+        {\n+        }\n+\n+        protected override int Check(IEnumerable<string> attributes, FilterSource filterSource)\n+        {\n+            CheckCalledCount++;\n+            var fileInfo = new FileInfo(filterSource.Path);\n+            var matches = attributes.Any(currentExtension => fileInfo.Extension == currentExtension);\n+            return matches ? 0 : -30;\n+        }\n+\n+        protected override int Clean(string path, GitBufReader input, GitBufWriter output)\n+        {\n+            CleanCalledCount++;\n+            return RotatByThirteenPlaces(input, output);\n+        }\n+\n+        protected override int Smudge(string path, GitBufReader input, GitBufWriter output)\n+        {\n+            SmudgeCalledCount++;\n+            return RotatByThirteenPlaces(input, output);\n+        }\n+\n+        public static int RotatByThirteenPlaces(GitBufReader input, GitBufWriter output)","path":"LibGit2Sharp.Tests/TestHelpers/SubstitutionCipherFilter.cs","position":40,"original_position":40,"commit_id":"8bedc3bd98bd99020308f05d3da2b90858b77604","original_commit_id":"8bedc3bd98bd99020308f05d3da2b90858b77604","user":{"login":"dahlbyk","id":133987,"avatar_url":"https://avatars.githubusercontent.com/u/133987?v=3","gravatar_id":"","url":"https://api.github.com/users/dahlbyk","html_url":"https://github.com/dahlbyk","followers_url":"https://api.github.com/users/dahlbyk/followers","following_url":"https://api.github.com/users/dahlbyk/following{/other_user}","gists_url":"https://api.github.com/users/dahlbyk/gists{/gist_id}","starred_url":"https://api.github.com/users/dahlbyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahlbyk/subscriptions","organizations_url":"https://api.github.com/users/dahlbyk/orgs","repos_url":"https://api.github.com/users/dahlbyk/repos","events_url":"https://api.github.com/users/dahlbyk/events{/privacy}","received_events_url":"https://api.github.com/users/dahlbyk/received_events","type":"User","site_admin":false},"body":"\"Rotate\" :smiling_imp: ","created_at":"2015-02-07T21:42:43Z","updated_at":"2015-02-07T21:42:43Z","html_url":"https://github.com/libgit2/libgit2sharp/pull/854#discussion_r24293195","pull_request_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854","_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/24293195"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/854#discussion_r24293195"},"pull_request":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854"}}},"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854","id":23565125,"html_url":"https://github.com/libgit2/libgit2sharp/pull/854","diff_url":"https://github.com/libgit2/libgit2sharp/pull/854.diff","patch_url":"https://github.com/libgit2/libgit2sharp/pull/854.patch","issue_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/854","number":854,"state":"open","locked":false,"title":"Register custom filters","user":{"login":"ammeep","id":1024672,"avatar_url":"https://avatars.githubusercontent.com/u/1024672?v=3","gravatar_id":"","url":"https://api.github.com/users/ammeep","html_url":"https://github.com/ammeep","followers_url":"https://api.github.com/users/ammeep/followers","following_url":"https://api.github.com/users/ammeep/following{/other_user}","gists_url":"https://api.github.com/users/ammeep/gists{/gist_id}","starred_url":"https://api.github.com/users/ammeep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ammeep/subscriptions","organizations_url":"https://api.github.com/users/ammeep/orgs","repos_url":"https://api.github.com/users/ammeep/repos","events_url":"https://api.github.com/users/ammeep/events{/privacy}","received_events_url":"https://api.github.com/users/ammeep/received_events","type":"User","site_admin":true},"body":"I want to expose an API for registering custom clean and smudge filters via libgit2.\r\n\r\nMy knowledge of C is rusty, and this is the first time I have looked at libgit2sharp in any great detail. So, I'm going to open this PR early, in the hopes that if anyone has time to spot anything terrible I do along the way they will be able to point me in the right direction :pray: \r\n\r\n###  Todo\r\n\r\n- [x] Register and deregsiter a filter\r\n- [x] Define apply callback\r\n- [x] Define check callback\r\n- [x] Define shutdown/init callbacks\r\n- [x] Tests","created_at":"2014-10-29T21:10:14Z","updated_at":"2015-02-07T21:42:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7aaf813d1354c4c3b956ffe183d0648700d431bf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854/commits","review_comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854/comments","review_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/{number}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/854/comments","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/8bedc3bd98bd99020308f05d3da2b90858b77604","head":{"label":"libgit2:register-custom-filters","ref":"register-custom-filters","sha":"8bedc3bd98bd99020308f05d3da2b90858b77604","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-02-07T14:02:14Z","pushed_at":"2015-02-07T14:02: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":196018,"stargazers_count":698,"watchers_count":698,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":280,"mirror_url":null,"open_issues_count":123,"forks":280,"open_issues":123,"watchers":698,"default_branch":"vNext"}},"base":{"label":"libgit2:vNext","ref":"vNext","sha":"bd06dac2db9947808a933d217e21816f05a77dc9","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-02-07T14:02:14Z","pushed_at":"2015-02-07T14:02: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":196018,"stargazers_count":698,"watchers_count":698,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":280,"mirror_url":null,"open_issues_count":123,"forks":280,"open_issues":123,"watchers":698,"default_branch":"vNext"}},"_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/854"},"issue":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/854"},"comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/854/comments"},"review_comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854/comments"},"review_comment":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/854/commits"},"statuses":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/8bedc3bd98bd99020308f05d3da2b90858b77604"}}}}