{"action":"created","comment":{"url":"https://api.github.com/repos/jelmer/dulwich/pulls/comments/35846833","id":35846833,"diff_hunk":"@@ -765,3 +766,16 @@ def test_commit_no_encode_decode(self):\n             mode, id = tree_lookup_path(r.get_object, r[commit_sha].tree, name)\n             self.assertEqual(stat.S_IFREG | 0o644, mode)\n             self.assertEqual(encoding.encode('ascii'), r[id].data)\n+\n+    def test_discover_intended(self):\n+        path = os.path.join(self._repo_dir, 'b/c')\n+        r = Repo.discover(path)\n+        self.assertEqual(r.head(), self._repo.head())\n+\n+    def test_discover_isrepo(self):\n+        r = Repo.discover(self._repo_dir)\n+        self.assertEqual(r.head(), self._repo.head())\n+\n+    def test_discover_notrepo(self):\n+        with self.assertRaises(NotGitRepository):","path":"dulwich/tests/test_repository.py","position":23,"original_position":23,"commit_id":"d09403d13b7a6579489e586ed0c2ed1bce3cc7eb","original_commit_id":"d09403d13b7a6579489e586ed0c2ed1bce3cc7eb","user":{"login":"bmcorser","id":1449387,"avatar_url":"https://avatars.githubusercontent.com/u/1449387?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcorser","html_url":"https://github.com/bmcorser","followers_url":"https://api.github.com/users/bmcorser/followers","following_url":"https://api.github.com/users/bmcorser/following{/other_user}","gists_url":"https://api.github.com/users/bmcorser/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcorser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcorser/subscriptions","organizations_url":"https://api.github.com/users/bmcorser/orgs","repos_url":"https://api.github.com/users/bmcorser/repos","events_url":"https://api.github.com/users/bmcorser/events{/privacy}","received_events_url":"https://api.github.com/users/bmcorser/received_events","type":"User","site_admin":false},"body":"Cool","created_at":"2015-07-30T08:01:02Z","updated_at":"2015-07-30T08:01:02Z","html_url":"https://github.com/jelmer/dulwich/pull/359#discussion_r35846833","pull_request_url":"https://api.github.com/repos/jelmer/dulwich/pulls/359","_links":{"self":{"href":"https://api.github.com/repos/jelmer/dulwich/pulls/comments/35846833"},"html":{"href":"https://github.com/jelmer/dulwich/pull/359#discussion_r35846833"},"pull_request":{"href":"https://api.github.com/repos/jelmer/dulwich/pulls/359"}}},"pull_request":{"url":"https://api.github.com/repos/jelmer/dulwich/pulls/359","id":40984726,"html_url":"https://github.com/jelmer/dulwich/pull/359","diff_url":"https://github.com/jelmer/dulwich/pull/359.diff","patch_url":"https://github.com/jelmer/dulwich/pull/359.patch","issue_url":"https://api.github.com/repos/jelmer/dulwich/issues/359","number":359,"state":"open","locked":false,"title":"Add `discover` classmethod","user":{"login":"bmcorser","id":1449387,"avatar_url":"https://avatars.githubusercontent.com/u/1449387?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcorser","html_url":"https://github.com/bmcorser","followers_url":"https://api.github.com/users/bmcorser/followers","following_url":"https://api.github.com/users/bmcorser/following{/other_user}","gists_url":"https://api.github.com/users/bmcorser/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcorser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcorser/subscriptions","organizations_url":"https://api.github.com/users/bmcorser/orgs","repos_url":"https://api.github.com/users/bmcorser/repos","events_url":"https://api.github.com/users/bmcorser/events{/privacy}","received_events_url":"https://api.github.com/users/bmcorser/received_events","type":"User","site_admin":false},"body":"Method to instantiate a `Repo` object from a subdirectory of a repository (this is kind of normal Git CLI behaviour), they have it in the [Rust lib](https://github.com/alexcrichton/git2-rs/blob/master/src/repo.rs#L64-L74) so I \"borrowed\" it.","created_at":"2015-07-28T08:02:45Z","updated_at":"2015-07-30T08:01:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64402c8cd44eedb848a469d2dfe9664ff5be3872","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jelmer/dulwich/pulls/359/commits","review_comments_url":"https://api.github.com/repos/jelmer/dulwich/pulls/359/comments","review_comment_url":"https://api.github.com/repos/jelmer/dulwich/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jelmer/dulwich/issues/359/comments","statuses_url":"https://api.github.com/repos/jelmer/dulwich/statuses/d09403d13b7a6579489e586ed0c2ed1bce3cc7eb","head":{"label":"bmcorser:master","ref":"master","sha":"d09403d13b7a6579489e586ed0c2ed1bce3cc7eb","user":{"login":"bmcorser","id":1449387,"avatar_url":"https://avatars.githubusercontent.com/u/1449387?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcorser","html_url":"https://github.com/bmcorser","followers_url":"https://api.github.com/users/bmcorser/followers","following_url":"https://api.github.com/users/bmcorser/following{/other_user}","gists_url":"https://api.github.com/users/bmcorser/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcorser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcorser/subscriptions","organizations_url":"https://api.github.com/users/bmcorser/orgs","repos_url":"https://api.github.com/users/bmcorser/repos","events_url":"https://api.github.com/users/bmcorser/events{/privacy}","received_events_url":"https://api.github.com/users/bmcorser/received_events","type":"User","site_admin":false},"repo":{"id":39815826,"name":"dulwich","full_name":"bmcorser/dulwich","owner":{"login":"bmcorser","id":1449387,"avatar_url":"https://avatars.githubusercontent.com/u/1449387?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcorser","html_url":"https://github.com/bmcorser","followers_url":"https://api.github.com/users/bmcorser/followers","following_url":"https://api.github.com/users/bmcorser/following{/other_user}","gists_url":"https://api.github.com/users/bmcorser/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcorser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcorser/subscriptions","organizations_url":"https://api.github.com/users/bmcorser/orgs","repos_url":"https://api.github.com/users/bmcorser/repos","events_url":"https://api.github.com/users/bmcorser/events{/privacy}","received_events_url":"https://api.github.com/users/bmcorser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bmcorser/dulwich","description":"Pure-Python Git implementation","fork":true,"url":"https://api.github.com/repos/bmcorser/dulwich","forks_url":"https://api.github.com/repos/bmcorser/dulwich/forks","keys_url":"https://api.github.com/repos/bmcorser/dulwich/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bmcorser/dulwich/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bmcorser/dulwich/teams","hooks_url":"https://api.github.com/repos/bmcorser/dulwich/hooks","issue_events_url":"https://api.github.com/repos/bmcorser/dulwich/issues/events{/number}","events_url":"https://api.github.com/repos/bmcorser/dulwich/events","assignees_url":"https://api.github.com/repos/bmcorser/dulwich/assignees{/user}","branches_url":"https://api.github.com/repos/bmcorser/dulwich/branches{/branch}","tags_url":"https://api.github.com/repos/bmcorser/dulwich/tags","blobs_url":"https://api.github.com/repos/bmcorser/dulwich/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bmcorser/dulwich/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bmcorser/dulwich/git/refs{/sha}","trees_url":"https://api.github.com/repos/bmcorser/dulwich/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bmcorser/dulwich/statuses/{sha}","languages_url":"https://api.github.com/repos/bmcorser/dulwich/languages","stargazers_url":"https://api.github.com/repos/bmcorser/dulwich/stargazers","contributors_url":"https://api.github.com/repos/bmcorser/dulwich/contributors","subscribers_url":"https://api.github.com/repos/bmcorser/dulwich/subscribers","subscription_url":"https://api.github.com/repos/bmcorser/dulwich/subscription","commits_url":"https://api.github.com/repos/bmcorser/dulwich/commits{/sha}","git_commits_url":"https://api.github.com/repos/bmcorser/dulwich/git/commits{/sha}","comments_url":"https://api.github.com/repos/bmcorser/dulwich/comments{/number}","issue_comment_url":"https://api.github.com/repos/bmcorser/dulwich/issues/comments{/number}","contents_url":"https://api.github.com/repos/bmcorser/dulwich/contents/{+path}","compare_url":"https://api.github.com/repos/bmcorser/dulwich/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bmcorser/dulwich/merges","archive_url":"https://api.github.com/repos/bmcorser/dulwich/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bmcorser/dulwich/downloads","issues_url":"https://api.github.com/repos/bmcorser/dulwich/issues{/number}","pulls_url":"https://api.github.com/repos/bmcorser/dulwich/pulls{/number}","milestones_url":"https://api.github.com/repos/bmcorser/dulwich/milestones{/number}","notifications_url":"https://api.github.com/repos/bmcorser/dulwich/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bmcorser/dulwich/labels{/name}","releases_url":"https://api.github.com/repos/bmcorser/dulwich/releases{/id}","created_at":"2015-07-28T05:55:55Z","updated_at":"2015-07-28T05:55:56Z","pushed_at":"2015-07-29T15:07:14Z","git_url":"git://github.com/bmcorser/dulwich.git","ssh_url":"git@github.com:bmcorser/dulwich.git","clone_url":"https://github.com/bmcorser/dulwich.git","svn_url":"https://github.com/bmcorser/dulwich","homepage":"https://samba.org/~jelmer/dulwich/","size":12115,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"master"}},"base":{"label":"jelmer:master","ref":"master","sha":"5f17ec5808abbc43c7db5141b494a86504f28b68","user":{"login":"jelmer","id":49032,"avatar_url":"https://avatars.githubusercontent.com/u/49032?v=3","gravatar_id":"","url":"https://api.github.com/users/jelmer","html_url":"https://github.com/jelmer","followers_url":"https://api.github.com/users/jelmer/followers","following_url":"https://api.github.com/users/jelmer/following{/other_user}","gists_url":"https://api.github.com/users/jelmer/gists{/gist_id}","starred_url":"https://api.github.com/users/jelmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelmer/subscriptions","organizations_url":"https://api.github.com/users/jelmer/orgs","repos_url":"https://api.github.com/users/jelmer/repos","events_url":"https://api.github.com/users/jelmer/events{/privacy}","received_events_url":"https://api.github.com/users/jelmer/received_events","type":"User","site_admin":false},"repo":{"id":156187,"name":"dulwich","full_name":"jelmer/dulwich","owner":{"login":"jelmer","id":49032,"avatar_url":"https://avatars.githubusercontent.com/u/49032?v=3","gravatar_id":"","url":"https://api.github.com/users/jelmer","html_url":"https://github.com/jelmer","followers_url":"https://api.github.com/users/jelmer/followers","following_url":"https://api.github.com/users/jelmer/following{/other_user}","gists_url":"https://api.github.com/users/jelmer/gists{/gist_id}","starred_url":"https://api.github.com/users/jelmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelmer/subscriptions","organizations_url":"https://api.github.com/users/jelmer/orgs","repos_url":"https://api.github.com/users/jelmer/repos","events_url":"https://api.github.com/users/jelmer/events{/privacy}","received_events_url":"https://api.github.com/users/jelmer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jelmer/dulwich","description":"Pure-Python Git implementation","fork":false,"url":"https://api.github.com/repos/jelmer/dulwich","forks_url":"https://api.github.com/repos/jelmer/dulwich/forks","keys_url":"https://api.github.com/repos/jelmer/dulwich/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jelmer/dulwich/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jelmer/dulwich/teams","hooks_url":"https://api.github.com/repos/jelmer/dulwich/hooks","issue_events_url":"https://api.github.com/repos/jelmer/dulwich/issues/events{/number}","events_url":"https://api.github.com/repos/jelmer/dulwich/events","assignees_url":"https://api.github.com/repos/jelmer/dulwich/assignees{/user}","branches_url":"https://api.github.com/repos/jelmer/dulwich/branches{/branch}","tags_url":"https://api.github.com/repos/jelmer/dulwich/tags","blobs_url":"https://api.github.com/repos/jelmer/dulwich/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jelmer/dulwich/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jelmer/dulwich/git/refs{/sha}","trees_url":"https://api.github.com/repos/jelmer/dulwich/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jelmer/dulwich/statuses/{sha}","languages_url":"https://api.github.com/repos/jelmer/dulwich/languages","stargazers_url":"https://api.github.com/repos/jelmer/dulwich/stargazers","contributors_url":"https://api.github.com/repos/jelmer/dulwich/contributors","subscribers_url":"https://api.github.com/repos/jelmer/dulwich/subscribers","subscription_url":"https://api.github.com/repos/jelmer/dulwich/subscription","commits_url":"https://api.github.com/repos/jelmer/dulwich/commits{/sha}","git_commits_url":"https://api.github.com/repos/jelmer/dulwich/git/commits{/sha}","comments_url":"https://api.github.com/repos/jelmer/dulwich/comments{/number}","issue_comment_url":"https://api.github.com/repos/jelmer/dulwich/issues/comments{/number}","contents_url":"https://api.github.com/repos/jelmer/dulwich/contents/{+path}","compare_url":"https://api.github.com/repos/jelmer/dulwich/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jelmer/dulwich/merges","archive_url":"https://api.github.com/repos/jelmer/dulwich/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jelmer/dulwich/downloads","issues_url":"https://api.github.com/repos/jelmer/dulwich/issues{/number}","pulls_url":"https://api.github.com/repos/jelmer/dulwich/pulls{/number}","milestones_url":"https://api.github.com/repos/jelmer/dulwich/milestones{/number}","notifications_url":"https://api.github.com/repos/jelmer/dulwich/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jelmer/dulwich/labels{/name}","releases_url":"https://api.github.com/repos/jelmer/dulwich/releases{/id}","created_at":"2009-03-22T05:09:18Z","updated_at":"2015-07-28T06:51:55Z","pushed_at":"2015-07-30T06:07:05Z","git_url":"git://github.com/jelmer/dulwich.git","ssh_url":"git@github.com:jelmer/dulwich.git","clone_url":"https://github.com/jelmer/dulwich.git","svn_url":"https://github.com/jelmer/dulwich","homepage":"https://samba.org/~jelmer/dulwich/","size":12115,"stargazers_count":804,"watchers_count":804,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":182,"mirror_url":null,"open_issues_count":26,"forks":182,"open_issues":26,"watchers":804,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jelmer/dulwich/pulls/359"},"html":{"href":"https://github.com/jelmer/dulwich/pull/359"},"issue":{"href":"https://api.github.com/repos/jelmer/dulwich/issues/359"},"comments":{"href":"https://api.github.com/repos/jelmer/dulwich/issues/359/comments"},"review_comments":{"href":"https://api.github.com/repos/jelmer/dulwich/pulls/359/comments"},"review_comment":{"href":"https://api.github.com/repos/jelmer/dulwich/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jelmer/dulwich/pulls/359/commits"},"statuses":{"href":"https://api.github.com/repos/jelmer/dulwich/statuses/d09403d13b7a6579489e586ed0c2ed1bce3cc7eb"}}}}