{"action":"created","comment":{"url":"https://api.github.com/repos/atom/git-utils/pulls/comments/48746025","id":48746025,"diff_hunk":"@@ -326,6 +328,47 @@ NAN_METHOD(Repository::GetStatus) {\n   }\n }\n \n+NAN_METHOD(Repository::GetStatusForPaths) {\n+  Nan::HandleScope scope;\n+  Local<Object> result = Nan::New<Object>();\n+  std::map<std::string, unsigned int> statuses;\n+  git_status_options options = GIT_STATUS_OPTIONS_INIT;\n+  options.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |\n+                  GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS |\n+                  GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH;\n+\n+  Array *pathsArg = Array::Cast(*info[0]);\n+  unsigned int pathsLength = pathsArg->Length();\n+  char *path = NULL;\n+  char **paths = reinterpret_cast<char **>(malloc(pathsLength * sizeof(path)));\n+  for (unsigned int i = 0; i < pathsLength; i++) {\n+    String::Utf8Value utf8Path(pathsArg->Get(i));\n+    path = strdup(*utf8Path);","path":"src/repository.cc","position":28,"original_position":28,"commit_id":"c23358d3aafb0f1f9500f600cb35a8bccc4b87e6","original_commit_id":"c23358d3aafb0f1f9500f600cb35a8bccc4b87e6","user":{"login":"joshaber","id":13760,"avatar_url":"https://avatars.githubusercontent.com/u/13760?v=3","gravatar_id":"","url":"https://api.github.com/users/joshaber","html_url":"https://github.com/joshaber","followers_url":"https://api.github.com/users/joshaber/followers","following_url":"https://api.github.com/users/joshaber/following{/other_user}","gists_url":"https://api.github.com/users/joshaber/gists{/gist_id}","starred_url":"https://api.github.com/users/joshaber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshaber/subscriptions","organizations_url":"https://api.github.com/users/joshaber/orgs","repos_url":"https://api.github.com/users/joshaber/repos","events_url":"https://api.github.com/users/joshaber/events{/privacy}","received_events_url":"https://api.github.com/users/joshaber/received_events","type":"User","site_admin":true},"body":"That's a really good question. The Internet indicates that `strdup` is POSIX but not Standard. That said, it builds fine on my Windows VM. If we find this is a problem I'll come back and fix this.","created_at":"2016-01-04T16:07:30Z","updated_at":"2016-01-04T16:07:30Z","html_url":"https://github.com/atom/git-utils/pull/63#discussion_r48746025","pull_request_url":"https://api.github.com/repos/atom/git-utils/pulls/63","_links":{"self":{"href":"https://api.github.com/repos/atom/git-utils/pulls/comments/48746025"},"html":{"href":"https://github.com/atom/git-utils/pull/63#discussion_r48746025"},"pull_request":{"href":"https://api.github.com/repos/atom/git-utils/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/atom/git-utils/pulls/63","id":54896878,"html_url":"https://github.com/atom/git-utils/pull/63","diff_url":"https://github.com/atom/git-utils/pull/63.diff","patch_url":"https://github.com/atom/git-utils/pull/63.patch","issue_url":"https://api.github.com/repos/atom/git-utils/issues/63","number":63,"state":"open","locked":false,"title":"Add getStatusForPaths","user":{"login":"joshaber","id":13760,"avatar_url":"https://avatars.githubusercontent.com/u/13760?v=3","gravatar_id":"","url":"https://api.github.com/users/joshaber","html_url":"https://github.com/joshaber","followers_url":"https://api.github.com/users/joshaber/followers","following_url":"https://api.github.com/users/joshaber/following{/other_user}","gists_url":"https://api.github.com/users/joshaber/gists{/gist_id}","starred_url":"https://api.github.com/users/joshaber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshaber/subscriptions","organizations_url":"https://api.github.com/users/joshaber/orgs","repos_url":"https://api.github.com/users/joshaber/repos","events_url":"https://api.github.com/users/joshaber/events{/privacy}","received_events_url":"https://api.github.com/users/joshaber/received_events","type":"User","site_admin":true},"body":"(Supersedes #62.)\r\n\r\nThis will (hopefully) let us fix performance issues like https://github.com/atom/atom/issues/6437 and https://github.com/atom/atom/issues/3426.\r\n\r\nThe problem:\r\n\r\n1. We use `git_repository_open_ext` which will search for a repository if the directory you give it isn’t a repository.\r\n1. Some people (knowingly or unknowingly) have a git repository in their home directory.\r\n1. We find that repository in `$HOME` and request its status.\r\n1. Because we include `GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS` in our status options, libgit2 has to visit literally every directory in the user’s home, recursively.\r\n1. So instead, let’s have the ability to give libgit2 a pathspec so that it knows we only care about a subdirectory within the repository.","created_at":"2016-01-01T21:43:56Z","updated_at":"2016-01-04T16:07:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"86c39b82599c489f901e56ef83732096691b4c67","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/atom/git-utils/pulls/63/commits","review_comments_url":"https://api.github.com/repos/atom/git-utils/pulls/63/comments","review_comment_url":"https://api.github.com/repos/atom/git-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atom/git-utils/issues/63/comments","statuses_url":"https://api.github.com/repos/atom/git-utils/statuses/c23358d3aafb0f1f9500f600cb35a8bccc4b87e6","head":{"label":"atom:status-within-pathspec","ref":"status-within-pathspec","sha":"c23358d3aafb0f1f9500f600cb35a8bccc4b87e6","user":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"repo":{"id":8657727,"name":"git-utils","full_name":"atom/git-utils","owner":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atom/git-utils","description":"Git Node Module","fork":false,"url":"https://api.github.com/repos/atom/git-utils","forks_url":"https://api.github.com/repos/atom/git-utils/forks","keys_url":"https://api.github.com/repos/atom/git-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atom/git-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atom/git-utils/teams","hooks_url":"https://api.github.com/repos/atom/git-utils/hooks","issue_events_url":"https://api.github.com/repos/atom/git-utils/issues/events{/number}","events_url":"https://api.github.com/repos/atom/git-utils/events","assignees_url":"https://api.github.com/repos/atom/git-utils/assignees{/user}","branches_url":"https://api.github.com/repos/atom/git-utils/branches{/branch}","tags_url":"https://api.github.com/repos/atom/git-utils/tags","blobs_url":"https://api.github.com/repos/atom/git-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atom/git-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atom/git-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/atom/git-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atom/git-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/atom/git-utils/languages","stargazers_url":"https://api.github.com/repos/atom/git-utils/stargazers","contributors_url":"https://api.github.com/repos/atom/git-utils/contributors","subscribers_url":"https://api.github.com/repos/atom/git-utils/subscribers","subscription_url":"https://api.github.com/repos/atom/git-utils/subscription","commits_url":"https://api.github.com/repos/atom/git-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/atom/git-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/atom/git-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/atom/git-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/atom/git-utils/contents/{+path}","compare_url":"https://api.github.com/repos/atom/git-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atom/git-utils/merges","archive_url":"https://api.github.com/repos/atom/git-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atom/git-utils/downloads","issues_url":"https://api.github.com/repos/atom/git-utils/issues{/number}","pulls_url":"https://api.github.com/repos/atom/git-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/atom/git-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/atom/git-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atom/git-utils/labels{/name}","releases_url":"https://api.github.com/repos/atom/git-utils/releases{/id}","created_at":"2013-03-08T18:57:00Z","updated_at":"2016-01-04T14:47:32Z","pushed_at":"2016-01-01T21:44:46Z","git_url":"git://github.com/atom/git-utils.git","ssh_url":"git@github.com:atom/git-utils.git","clone_url":"https://github.com/atom/git-utils.git","svn_url":"https://github.com/atom/git-utils","homepage":"http://atom.github.io/git-utils","size":331,"stargazers_count":106,"watchers_count":106,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":20,"forks":29,"open_issues":20,"watchers":106,"default_branch":"master"}},"base":{"label":"atom:master","ref":"master","sha":"455f49d27c3402f97454b01741d5e4eea945ff16","user":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"repo":{"id":8657727,"name":"git-utils","full_name":"atom/git-utils","owner":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atom/git-utils","description":"Git Node Module","fork":false,"url":"https://api.github.com/repos/atom/git-utils","forks_url":"https://api.github.com/repos/atom/git-utils/forks","keys_url":"https://api.github.com/repos/atom/git-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atom/git-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atom/git-utils/teams","hooks_url":"https://api.github.com/repos/atom/git-utils/hooks","issue_events_url":"https://api.github.com/repos/atom/git-utils/issues/events{/number}","events_url":"https://api.github.com/repos/atom/git-utils/events","assignees_url":"https://api.github.com/repos/atom/git-utils/assignees{/user}","branches_url":"https://api.github.com/repos/atom/git-utils/branches{/branch}","tags_url":"https://api.github.com/repos/atom/git-utils/tags","blobs_url":"https://api.github.com/repos/atom/git-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atom/git-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atom/git-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/atom/git-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atom/git-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/atom/git-utils/languages","stargazers_url":"https://api.github.com/repos/atom/git-utils/stargazers","contributors_url":"https://api.github.com/repos/atom/git-utils/contributors","subscribers_url":"https://api.github.com/repos/atom/git-utils/subscribers","subscription_url":"https://api.github.com/repos/atom/git-utils/subscription","commits_url":"https://api.github.com/repos/atom/git-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/atom/git-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/atom/git-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/atom/git-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/atom/git-utils/contents/{+path}","compare_url":"https://api.github.com/repos/atom/git-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atom/git-utils/merges","archive_url":"https://api.github.com/repos/atom/git-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atom/git-utils/downloads","issues_url":"https://api.github.com/repos/atom/git-utils/issues{/number}","pulls_url":"https://api.github.com/repos/atom/git-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/atom/git-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/atom/git-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atom/git-utils/labels{/name}","releases_url":"https://api.github.com/repos/atom/git-utils/releases{/id}","created_at":"2013-03-08T18:57:00Z","updated_at":"2016-01-04T14:47:32Z","pushed_at":"2016-01-01T21:44:46Z","git_url":"git://github.com/atom/git-utils.git","ssh_url":"git@github.com:atom/git-utils.git","clone_url":"https://github.com/atom/git-utils.git","svn_url":"https://github.com/atom/git-utils","homepage":"http://atom.github.io/git-utils","size":331,"stargazers_count":106,"watchers_count":106,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":29,"mirror_url":null,"open_issues_count":20,"forks":29,"open_issues":20,"watchers":106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atom/git-utils/pulls/63"},"html":{"href":"https://github.com/atom/git-utils/pull/63"},"issue":{"href":"https://api.github.com/repos/atom/git-utils/issues/63"},"comments":{"href":"https://api.github.com/repos/atom/git-utils/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/atom/git-utils/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/atom/git-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atom/git-utils/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/atom/git-utils/statuses/c23358d3aafb0f1f9500f600cb35a8bccc4b87e6"}}}}