{"action":"created","comment":{"url":"https://api.github.com/repos/projectkudu/kudu/pulls/comments/23439663","id":23439663,"diff_hunk":"@@ -0,0 +1,396 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Text;\n+using System.Threading.Tasks;\n+using Kudu.Contracts.Settings;\n+using Kudu.Core.Tracing;\n+using System.IO;\n+using Kudu.Core.Infrastructure;\n+using LibGit2Sharp;\n+using Kudu.Contracts.Tracing;\n+using System.Text.RegularExpressions;\n+\n+namespace Kudu.Core.SourceControl.Git\n+{\n+    public class LibGit2SharpRepository : IRepository\n+    {\n+        private const string _remoteAlias = \"external\";\n+        private readonly ITraceFactory _tracerFactory;\n+        private readonly IDeploymentSettingsManager _settings;\n+        private readonly GitExeRepository _legacyGitExeRepository;\n+\n+        public LibGit2SharpRepository(IEnvironment environment, IDeploymentSettingsManager settings, ITraceFactory tracerFactory)\n+        {\n+            _tracerFactory = tracerFactory;\n+            _settings = settings;\n+            RepositoryPath = environment.RepositoryPath;\n+            _legacyGitExeRepository = new GitExeRepository(environment, settings, tracerFactory);\n+        }\n+\n+        public string CurrentId\n+        {\n+            get \n+            {\n+                using (var repo = new LibGit2Sharp.Repository(RepositoryPath))","path":"Kudu.Core/SourceControl/Git/LibGit2SharpRepository.cs","position":35,"original_position":35,"commit_id":"ae2af03af72279b9ab224360fdb93b5661ad2417","original_commit_id":"8733b97f54459fae28ed9725b3000c47026b8da6","user":{"login":"carlosmn","id":335443,"avatar_url":"https://avatars.githubusercontent.com/u/335443?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosmn","html_url":"https://github.com/carlosmn","followers_url":"https://api.github.com/users/carlosmn/followers","following_url":"https://api.github.com/users/carlosmn/following{/other_user}","gists_url":"https://api.github.com/users/carlosmn/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmn/subscriptions","organizations_url":"https://api.github.com/users/carlosmn/orgs","repos_url":"https://api.github.com/users/carlosmn/repos","events_url":"https://api.github.com/users/carlosmn/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmn/received_events","type":"User","site_admin":false},"body":"Changes to the index are not automatically reflected, but a bunch of functions which want an up-to-date view of the index do refresh it, like checkout or status.","created_at":"2015-01-23T09:36:12Z","updated_at":"2015-01-23T09:36:12Z","html_url":"https://github.com/projectkudu/kudu/pull/1440#discussion_r23439663","pull_request_url":"https://api.github.com/repos/projectkudu/kudu/pulls/1440","_links":{"self":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/comments/23439663"},"html":{"href":"https://github.com/projectkudu/kudu/pull/1440#discussion_r23439663"},"pull_request":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1440"}}},"pull_request":{"url":"https://api.github.com/repos/projectkudu/kudu/pulls/1440","id":27723071,"html_url":"https://github.com/projectkudu/kudu/pull/1440","diff_url":"https://github.com/projectkudu/kudu/pull/1440.diff","patch_url":"https://github.com/projectkudu/kudu/pull/1440.patch","issue_url":"https://api.github.com/repos/projectkudu/kudu/issues/1440","number":1440,"state":"open","locked":false,"title":"adding LibGit2SharpRepository to replace GitExeRepository ","user":{"login":"ahmelsayed","id":645740,"avatar_url":"https://avatars.githubusercontent.com/u/645740?v=3","gravatar_id":"","url":"https://api.github.com/users/ahmelsayed","html_url":"https://github.com/ahmelsayed","followers_url":"https://api.github.com/users/ahmelsayed/followers","following_url":"https://api.github.com/users/ahmelsayed/following{/other_user}","gists_url":"https://api.github.com/users/ahmelsayed/gists{/gist_id}","starred_url":"https://api.github.com/users/ahmelsayed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahmelsayed/subscriptions","organizations_url":"https://api.github.com/users/ahmelsayed/orgs","repos_url":"https://api.github.com/users/ahmelsayed/repos","events_url":"https://api.github.com/users/ahmelsayed/events{/privacy}","received_events_url":"https://api.github.com/users/ahmelsayed/received_events","type":"User","site_admin":false},"body":"`LibGit2SharpRepository` is supposed to replace `GitExeRepository` class. Things that LibGit2Sharp doesn't support yet have ~~been moved to `BaseGitRepository`~~ are supported though an instance of `GitExeRepository` called `_legacyGitExeRepository`. These operations are\r\n```\r\n> git submodule\r\n> git rebase\r\n```\r\n~~`> git rev-parse --git-dir`~~\r\n`_fileContent` in `VfsControllerBaseTest.cs` is updated to work around this issue https://github.com/libgit2/libgit2sharp/pull/688 \r\n\r\n\r\n**Note:** This PR doesn't include any flags to actually use the new `LibGit2SharpRepository` in any runtime code, so the runtime behavior before and after this PR should be exactly the same. However all the test cases pass with the new code path. I'll be adding the flag next.\r\nI updated all the test cases to use the new code path for git related stuff.\r\n\r\n@nulltoken any feedback would be greatly appreciated :)","created_at":"2015-01-20T23:37:51Z","updated_at":"2015-01-23T09:36:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5fa810a117b3a4afd26a8ed9a139150dc59928d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/projectkudu/kudu/pulls/1440/commits","review_comments_url":"https://api.github.com/repos/projectkudu/kudu/pulls/1440/comments","review_comment_url":"https://api.github.com/repos/projectkudu/kudu/pulls/comments/{number}","comments_url":"https://api.github.com/repos/projectkudu/kudu/issues/1440/comments","statuses_url":"https://api.github.com/repos/projectkudu/kudu/statuses/ae2af03af72279b9ab224360fdb93b5661ad2417","head":{"label":"projectkudu:ahmels-libgit2sharp","ref":"ahmels-libgit2sharp","sha":"ae2af03af72279b9ab224360fdb93b5661ad2417","user":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"repo":{"id":1939769,"name":"kudu","full_name":"projectkudu/kudu","owner":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectkudu/kudu","description":"Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.","fork":false,"url":"https://api.github.com/repos/projectkudu/kudu","forks_url":"https://api.github.com/repos/projectkudu/kudu/forks","keys_url":"https://api.github.com/repos/projectkudu/kudu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectkudu/kudu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectkudu/kudu/teams","hooks_url":"https://api.github.com/repos/projectkudu/kudu/hooks","issue_events_url":"https://api.github.com/repos/projectkudu/kudu/issues/events{/number}","events_url":"https://api.github.com/repos/projectkudu/kudu/events","assignees_url":"https://api.github.com/repos/projectkudu/kudu/assignees{/user}","branches_url":"https://api.github.com/repos/projectkudu/kudu/branches{/branch}","tags_url":"https://api.github.com/repos/projectkudu/kudu/tags","blobs_url":"https://api.github.com/repos/projectkudu/kudu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectkudu/kudu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectkudu/kudu/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectkudu/kudu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectkudu/kudu/statuses/{sha}","languages_url":"https://api.github.com/repos/projectkudu/kudu/languages","stargazers_url":"https://api.github.com/repos/projectkudu/kudu/stargazers","contributors_url":"https://api.github.com/repos/projectkudu/kudu/contributors","subscribers_url":"https://api.github.com/repos/projectkudu/kudu/subscribers","subscription_url":"https://api.github.com/repos/projectkudu/kudu/subscription","commits_url":"https://api.github.com/repos/projectkudu/kudu/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectkudu/kudu/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectkudu/kudu/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectkudu/kudu/issues/comments/{number}","contents_url":"https://api.github.com/repos/projectkudu/kudu/contents/{+path}","compare_url":"https://api.github.com/repos/projectkudu/kudu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectkudu/kudu/merges","archive_url":"https://api.github.com/repos/projectkudu/kudu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectkudu/kudu/downloads","issues_url":"https://api.github.com/repos/projectkudu/kudu/issues{/number}","pulls_url":"https://api.github.com/repos/projectkudu/kudu/pulls{/number}","milestones_url":"https://api.github.com/repos/projectkudu/kudu/milestones{/number}","notifications_url":"https://api.github.com/repos/projectkudu/kudu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectkudu/kudu/labels{/name}","releases_url":"https://api.github.com/repos/projectkudu/kudu/releases{/id}","created_at":"2011-06-23T05:36:20Z","updated_at":"2015-01-19T08:19:05Z","pushed_at":"2015-01-23T03:52:15Z","git_url":"git://github.com/projectkudu/kudu.git","ssh_url":"git@github.com:projectkudu/kudu.git","clone_url":"https://github.com/projectkudu/kudu.git","svn_url":"https://github.com/projectkudu/kudu","homepage":"","size":44144,"stargazers_count":815,"watchers_count":815,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":163,"mirror_url":null,"open_issues_count":91,"forks":163,"open_issues":91,"watchers":815,"default_branch":"master"}},"base":{"label":"projectkudu:master","ref":"master","sha":"2ff6506588fa05cb85b7e3e5ac4f148e2c04a6ad","user":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"repo":{"id":1939769,"name":"kudu","full_name":"projectkudu/kudu","owner":{"login":"projectkudu","id":927131,"avatar_url":"https://avatars.githubusercontent.com/u/927131?v=3","gravatar_id":"","url":"https://api.github.com/users/projectkudu","html_url":"https://github.com/projectkudu","followers_url":"https://api.github.com/users/projectkudu/followers","following_url":"https://api.github.com/users/projectkudu/following{/other_user}","gists_url":"https://api.github.com/users/projectkudu/gists{/gist_id}","starred_url":"https://api.github.com/users/projectkudu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectkudu/subscriptions","organizations_url":"https://api.github.com/users/projectkudu/orgs","repos_url":"https://api.github.com/users/projectkudu/repos","events_url":"https://api.github.com/users/projectkudu/events{/privacy}","received_events_url":"https://api.github.com/users/projectkudu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectkudu/kudu","description":"Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.","fork":false,"url":"https://api.github.com/repos/projectkudu/kudu","forks_url":"https://api.github.com/repos/projectkudu/kudu/forks","keys_url":"https://api.github.com/repos/projectkudu/kudu/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectkudu/kudu/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectkudu/kudu/teams","hooks_url":"https://api.github.com/repos/projectkudu/kudu/hooks","issue_events_url":"https://api.github.com/repos/projectkudu/kudu/issues/events{/number}","events_url":"https://api.github.com/repos/projectkudu/kudu/events","assignees_url":"https://api.github.com/repos/projectkudu/kudu/assignees{/user}","branches_url":"https://api.github.com/repos/projectkudu/kudu/branches{/branch}","tags_url":"https://api.github.com/repos/projectkudu/kudu/tags","blobs_url":"https://api.github.com/repos/projectkudu/kudu/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectkudu/kudu/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectkudu/kudu/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectkudu/kudu/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectkudu/kudu/statuses/{sha}","languages_url":"https://api.github.com/repos/projectkudu/kudu/languages","stargazers_url":"https://api.github.com/repos/projectkudu/kudu/stargazers","contributors_url":"https://api.github.com/repos/projectkudu/kudu/contributors","subscribers_url":"https://api.github.com/repos/projectkudu/kudu/subscribers","subscription_url":"https://api.github.com/repos/projectkudu/kudu/subscription","commits_url":"https://api.github.com/repos/projectkudu/kudu/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectkudu/kudu/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectkudu/kudu/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectkudu/kudu/issues/comments/{number}","contents_url":"https://api.github.com/repos/projectkudu/kudu/contents/{+path}","compare_url":"https://api.github.com/repos/projectkudu/kudu/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectkudu/kudu/merges","archive_url":"https://api.github.com/repos/projectkudu/kudu/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectkudu/kudu/downloads","issues_url":"https://api.github.com/repos/projectkudu/kudu/issues{/number}","pulls_url":"https://api.github.com/repos/projectkudu/kudu/pulls{/number}","milestones_url":"https://api.github.com/repos/projectkudu/kudu/milestones{/number}","notifications_url":"https://api.github.com/repos/projectkudu/kudu/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectkudu/kudu/labels{/name}","releases_url":"https://api.github.com/repos/projectkudu/kudu/releases{/id}","created_at":"2011-06-23T05:36:20Z","updated_at":"2015-01-19T08:19:05Z","pushed_at":"2015-01-23T03:52:15Z","git_url":"git://github.com/projectkudu/kudu.git","ssh_url":"git@github.com:projectkudu/kudu.git","clone_url":"https://github.com/projectkudu/kudu.git","svn_url":"https://github.com/projectkudu/kudu","homepage":"","size":44144,"stargazers_count":815,"watchers_count":815,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":163,"mirror_url":null,"open_issues_count":91,"forks":163,"open_issues":91,"watchers":815,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1440"},"html":{"href":"https://github.com/projectkudu/kudu/pull/1440"},"issue":{"href":"https://api.github.com/repos/projectkudu/kudu/issues/1440"},"comments":{"href":"https://api.github.com/repos/projectkudu/kudu/issues/1440/comments"},"review_comments":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1440/comments"},"review_comment":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/projectkudu/kudu/pulls/1440/commits"},"statuses":{"href":"https://api.github.com/repos/projectkudu/kudu/statuses/ae2af03af72279b9ab224360fdb93b5661ad2417"}}}}