{"action":"created","comment":{"url":"https://api.github.com/repos/libgit2/libgit2/pulls/comments/28897295","id":28897295,"diff_hunk":"@@ -303,3 +304,156 @@ char *git_win32_path_8dot3_name(const char *path)\n \n \treturn shortname;\n }\n+\n+#if !defined(__MINGW32__)\n+int git_win32_path_dirload_with_stat(\n+\tconst char *path,\n+\tsize_t prefix_len,\n+\tunsigned int flags,\n+\tconst char *start_stat,\n+\tconst char *end_stat,\n+\tgit_vector *contents)\n+{\n+\tint error = 0;\n+\tgit_path_with_stat *ps;\n+\tgit_win32_path pathw;\n+\tDIR *dir;\n+\tint(*strncomp)(const char *a, const char *b, size_t sz);\n+\tsize_t cmp_len;\n+\tsize_t start_len = start_stat ? strlen(start_stat) : 0;\n+\tsize_t end_len = end_stat ? strlen(end_stat) : 0;\n+\tsize_t path_size = strlen(path);\n+\tconst char *repo_path = path + prefix_len;\n+\tsize_t repo_path_len = strlen(repo_path);\n+\tchar work_path[32 * 1024]; // 32k is the longest \\\\?\\ filename possible\n+\tgit_win32_path target;\n+\tsize_t path_len;\n+\tint fMode;\n+\n+\tif (!git_win32__findfirstfile_filter(pathw, path))\n+\t{\n+\t\terror = -1;\n+\t\tgiterr_set(GITERR_OS, \"Could not parse the path '%s'\", path);\n+\t\tgoto clean_up_and_exit;\n+\t}\n+\n+\tstrncomp = (flags & GIT_PATH_DIR_IGNORE_CASE) != 0 \n+\t\t     ? git__strncasecmp \n+\t\t     : git__strncmp;\n+\n+\t/* use of FIND_FIRST_EX_LARGE_FETCH flag in the FindFirstFileExW call could benefit perormance\n+\t * here when querying large repositories on Windows 7 (0x0600) or newer versions of Windows.\n+\t * doing so could introduce compatibility issues on older versions of Windows. */\n+\tdir = git__calloc(1, sizeof(DIR));\n+\tdir->h = FindFirstFileExW(pathw, FindExInfoBasic, &dir->f, FindExSearchNameMatch, NULL, 0);\n+\tdir->first = 1;\n+\tif (dir->h == INVALID_HANDLE_VALUE)\n+\t{\n+\t\terror = -2;\n+\t\tgiterr_set(GITERR_OS, \"Could not open directory '%s'\", path);\n+\t\tgoto clean_up_and_exit;\n+\t}\n+\t\n+\tmemcpy(work_path, repo_path, repo_path_len);\n+\n+\twhile (dir)\n+\t{\n+\t\tif (git_path_is_dot_or_dotdotW(dir->f.cFileName))\n+\t\t\tgoto fetch_next;\n+\n+\t\tpath_len = git__utf16_to_8(work_path + repo_path_len, ARRAYSIZE(work_path) - repo_path_len, dir->f.cFileName);\n+\n+\t\twork_path[path_len + repo_path_len] = '\\0';\n+\t\tpath_len = path_len + repo_path_len;\n+\n+\t\tcmp_len = min(start_len, path_len);\n+\t\tif (cmp_len && strncomp(work_path, start_stat, cmp_len) < 0)\n+\t\t\tgoto fetch_next;\n+\n+\t\tcmp_len = min(end_len, path_len);\n+\t\tif (cmp_len && strncomp(work_path, end_stat, cmp_len) > 0)\n+\t\t\tgoto fetch_next;\t\n+\n+\t\tfMode = S_IREAD;\n+\n+\t\tif (dir->f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)\n+\t\t\tfMode |= S_IFDIR;\n+\t\telse\n+\t\t\tfMode |= S_IFREG;\n+\n+\t\tif (!(dir->f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))\n+\t\t\tfMode |= S_IWRITE;\n+\n+\t\tps = git__calloc(1, sizeof(git_path_with_stat) + path_len + 2);\n+\t\tmemcpy(ps->path, work_path, path_len + 1);\n+\t\tps->path_len = path_len;\n+\t\tps->st.st_atime = filetime_to_time_t(&dir->f.ftLastAccessTime);\n+\t\tps->st.st_ctime = filetime_to_time_t(&dir->f.ftCreationTime);\n+\t\tps->st.st_mtime = filetime_to_time_t(&dir->f.ftLastWriteTime);\n+\t\tps->st.st_size = dir->f.nFileSizeHigh;\n+\t\tps->st.st_size <<= 32;\n+\t\tps->st.st_size |= dir->f.nFileSizeLow;\n+\t\tps->st.st_dev = ps->st.st_rdev = (_getdrive() - 1);","path":"src/win32/path_w32.c","position":null,"original_position":101,"commit_id":"035f2481522664264669f61dc1415fef54650f84","original_commit_id":"d7564b76e769cdc5e1e5d878ba2fd4442508d2aa","user":{"login":"ethomson","id":1130014,"avatar_url":"https://avatars.githubusercontent.com/u/1130014?v=3","gravatar_id":"","url":"https://api.github.com/users/ethomson","html_url":"https://github.com/ethomson","followers_url":"https://api.github.com/users/ethomson/followers","following_url":"https://api.github.com/users/ethomson/following{/other_user}","gists_url":"https://api.github.com/users/ethomson/gists{/gist_id}","starred_url":"https://api.github.com/users/ethomson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethomson/subscriptions","organizations_url":"https://api.github.com/users/ethomson/orgs","repos_url":"https://api.github.com/users/ethomson/repos","events_url":"https://api.github.com/users/ethomson/events{/privacy}","received_events_url":"https://api.github.com/users/ethomson/received_events","type":"User","site_admin":false},"body":"Yes, that's what I was thinking as well.  We probably want to take a deeper look at this, but I agree that we've been getting it wrong up until this point and fixing it probably requires more research than a simple guess.  I opened #3069 to track this since I don't really think that this is necessarily blocking this.","created_at":"2015-04-22T17:49:49Z","updated_at":"2015-04-22T17:49:49Z","html_url":"https://github.com/libgit2/libgit2/pull/3054#discussion_r28897295","pull_request_url":"https://api.github.com/repos/libgit2/libgit2/pulls/3054","_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/comments/28897295"},"html":{"href":"https://github.com/libgit2/libgit2/pull/3054#discussion_r28897295"},"pull_request":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/3054"}}},"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2/pulls/3054","id":33564201,"html_url":"https://github.com/libgit2/libgit2/pull/3054","diff_url":"https://github.com/libgit2/libgit2/pull/3054.diff","patch_url":"https://github.com/libgit2/libgit2/pull/3054.patch","issue_url":"https://api.github.com/repos/libgit2/libgit2/issues/3054","number":3054,"state":"open","locked":false,"title":"Performance Improvements to Status on Windows","user":{"login":"whoisj","id":11578325,"avatar_url":"https://avatars.githubusercontent.com/u/11578325?v=3","gravatar_id":"","url":"https://api.github.com/users/whoisj","html_url":"https://github.com/whoisj","followers_url":"https://api.github.com/users/whoisj/followers","following_url":"https://api.github.com/users/whoisj/following{/other_user}","gists_url":"https://api.github.com/users/whoisj/gists{/gist_id}","starred_url":"https://api.github.com/users/whoisj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whoisj/subscriptions","organizations_url":"https://api.github.com/users/whoisj/orgs","repos_url":"https://api.github.com/users/whoisj/repos","events_url":"https://api.github.com/users/whoisj/events{/privacy}","received_events_url":"https://api.github.com/users/whoisj/received_events","type":"User","site_admin":false},"body":"Improves status on Win32 systems by a rather large margin. Brings libgit2 status on Win32 inline with git.git w/ core.fscache and core.preloadindex enabled.","created_at":"2015-04-17T17:18:06Z","updated_at":"2015-04-22T17:49:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17d5e73c3e989b540272d1d422d9e377fe5565c0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgit2/libgit2/pulls/3054/commits","review_comments_url":"https://api.github.com/repos/libgit2/libgit2/pulls/3054/comments","review_comment_url":"https://api.github.com/repos/libgit2/libgit2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libgit2/libgit2/issues/3054/comments","statuses_url":"https://api.github.com/repos/libgit2/libgit2/statuses/035f2481522664264669f61dc1415fef54650f84","head":{"label":"whoisj:whoisj/win32perf","ref":"whoisj/win32perf","sha":"035f2481522664264669f61dc1415fef54650f84","user":{"login":"whoisj","id":11578325,"avatar_url":"https://avatars.githubusercontent.com/u/11578325?v=3","gravatar_id":"","url":"https://api.github.com/users/whoisj","html_url":"https://github.com/whoisj","followers_url":"https://api.github.com/users/whoisj/followers","following_url":"https://api.github.com/users/whoisj/following{/other_user}","gists_url":"https://api.github.com/users/whoisj/gists{/gist_id}","starred_url":"https://api.github.com/users/whoisj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whoisj/subscriptions","organizations_url":"https://api.github.com/users/whoisj/orgs","repos_url":"https://api.github.com/users/whoisj/repos","events_url":"https://api.github.com/users/whoisj/events{/privacy}","received_events_url":"https://api.github.com/users/whoisj/received_events","type":"User","site_admin":false},"repo":{"id":34127680,"name":"libgit2","full_name":"whoisj/libgit2","owner":{"login":"whoisj","id":11578325,"avatar_url":"https://avatars.githubusercontent.com/u/11578325?v=3","gravatar_id":"","url":"https://api.github.com/users/whoisj","html_url":"https://github.com/whoisj","followers_url":"https://api.github.com/users/whoisj/followers","following_url":"https://api.github.com/users/whoisj/following{/other_user}","gists_url":"https://api.github.com/users/whoisj/gists{/gist_id}","starred_url":"https://api.github.com/users/whoisj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whoisj/subscriptions","organizations_url":"https://api.github.com/users/whoisj/orgs","repos_url":"https://api.github.com/users/whoisj/repos","events_url":"https://api.github.com/users/whoisj/events{/privacy}","received_events_url":"https://api.github.com/users/whoisj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/whoisj/libgit2","description":"The Library","fork":true,"url":"https://api.github.com/repos/whoisj/libgit2","forks_url":"https://api.github.com/repos/whoisj/libgit2/forks","keys_url":"https://api.github.com/repos/whoisj/libgit2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/whoisj/libgit2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/whoisj/libgit2/teams","hooks_url":"https://api.github.com/repos/whoisj/libgit2/hooks","issue_events_url":"https://api.github.com/repos/whoisj/libgit2/issues/events{/number}","events_url":"https://api.github.com/repos/whoisj/libgit2/events","assignees_url":"https://api.github.com/repos/whoisj/libgit2/assignees{/user}","branches_url":"https://api.github.com/repos/whoisj/libgit2/branches{/branch}","tags_url":"https://api.github.com/repos/whoisj/libgit2/tags","blobs_url":"https://api.github.com/repos/whoisj/libgit2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/whoisj/libgit2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/whoisj/libgit2/git/refs{/sha}","trees_url":"https://api.github.com/repos/whoisj/libgit2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/whoisj/libgit2/statuses/{sha}","languages_url":"https://api.github.com/repos/whoisj/libgit2/languages","stargazers_url":"https://api.github.com/repos/whoisj/libgit2/stargazers","contributors_url":"https://api.github.com/repos/whoisj/libgit2/contributors","subscribers_url":"https://api.github.com/repos/whoisj/libgit2/subscribers","subscription_url":"https://api.github.com/repos/whoisj/libgit2/subscription","commits_url":"https://api.github.com/repos/whoisj/libgit2/commits{/sha}","git_commits_url":"https://api.github.com/repos/whoisj/libgit2/git/commits{/sha}","comments_url":"https://api.github.com/repos/whoisj/libgit2/comments{/number}","issue_comment_url":"https://api.github.com/repos/whoisj/libgit2/issues/comments{/number}","contents_url":"https://api.github.com/repos/whoisj/libgit2/contents/{+path}","compare_url":"https://api.github.com/repos/whoisj/libgit2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/whoisj/libgit2/merges","archive_url":"https://api.github.com/repos/whoisj/libgit2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/whoisj/libgit2/downloads","issues_url":"https://api.github.com/repos/whoisj/libgit2/issues{/number}","pulls_url":"https://api.github.com/repos/whoisj/libgit2/pulls{/number}","milestones_url":"https://api.github.com/repos/whoisj/libgit2/milestones{/number}","notifications_url":"https://api.github.com/repos/whoisj/libgit2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/whoisj/libgit2/labels{/name}","releases_url":"https://api.github.com/repos/whoisj/libgit2/releases{/id}","created_at":"2015-04-17T16:36:41Z","updated_at":"2015-04-17T17:15:11Z","pushed_at":"2015-04-22T16:02:47Z","git_url":"git://github.com/whoisj/libgit2.git","ssh_url":"git@github.com:whoisj/libgit2.git","clone_url":"https://github.com/whoisj/libgit2.git","svn_url":"https://github.com/whoisj/libgit2","homepage":"http://libgit2.github.com","size":16985,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"libgit2:master","ref":"master","sha":"f564017d964e97c067baf98d2a332873bb641ffc","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":901662,"name":"libgit2","full_name":"libgit2/libgit2","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/libgit2","description":"The Library","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2","forks_url":"https://api.github.com/repos/libgit2/libgit2/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2/issues/comments{/number}","contents_url":"https://api.github.com/repos/libgit2/libgit2/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2/releases{/id}","created_at":"2010-09-10T16:17:48Z","updated_at":"2015-04-22T14:16:29Z","pushed_at":"2015-04-22T16:02:48Z","git_url":"git://github.com/libgit2/libgit2.git","ssh_url":"git@github.com:libgit2/libgit2.git","clone_url":"https://github.com/libgit2/libgit2.git","svn_url":"https://github.com/libgit2/libgit2","homepage":"http://libgit2.github.com","size":110380,"stargazers_count":4849,"watchers_count":4849,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1131,"mirror_url":null,"open_issues_count":124,"forks":1131,"open_issues":124,"watchers":4849,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/3054"},"html":{"href":"https://github.com/libgit2/libgit2/pull/3054"},"issue":{"href":"https://api.github.com/repos/libgit2/libgit2/issues/3054"},"comments":{"href":"https://api.github.com/repos/libgit2/libgit2/issues/3054/comments"},"review_comments":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/3054/comments"},"review_comment":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libgit2/libgit2/pulls/3054/commits"},"statuses":{"href":"https://api.github.com/repos/libgit2/libgit2/statuses/035f2481522664264669f61dc1415fef54650f84"}}}}