{"action":"created","comment":{"url":"https://api.github.com/repos/git-for-windows/git/pulls/comments/69379167","id":69379167,"diff_hunk":"@@ -0,0 +1,70 @@\n+#include \"../cache.h\"\n+#include \"../cache-tree.h\"\n+#include \"../diff.h\"\n+#include \"../diffcore.h\"\n+#include \"../revision.h\"\n+\n+static const char builtin_stash__helper_usage[] = {\n+\t\"Usage: git stash--helper --non-patch <i_tree>\"\n+};\n+\n+static void diff_callback(struct diff_queue_struct *q,\n+\t\t\t\t\t struct diff_options *options, void *data)\n+{\n+\tint i;\n+\tfor (i = 0; i < q->nr; i++)\n+    {\n+\t\tstruct diff_filepair *p;\n+\t\tstruct stat st;\n+\n+\t\tp = q->queue[i];\n+\t\tif (p->one && lstat(p->one->path, &st)) {\n+\t\t\twarning(\"Could not stat %s\", p->one->path);\n+\t\t\tcontinue;\n+\t\t}\n+\t\tadd_to_index(&the_index, p->one->path, &st, 0);\n+\t}\n+}\n+\n+int stash_non_patch(const char *i_tree,\tconst char *prefix)\n+{\n+\tint result;\n+\tstruct rev_info rev;\n+\tconst char *wt_prefix = NULL;\n+\tunsigned char sha1[20];\n+\tconst char *me = \"git stash--helper\";\n+\n+\tread_index(&the_index);\n+    refresh_cache(REFRESH_QUIET);\n+\tinit_revisions(&rev, NULL);\n+\tadd_head_to_pending(&rev);\n+\trev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;\n+\trev.diffopt.format_callback = diff_callback;\n+\trev.diffopt.format_callback_data=&result;\n+\tdiff_setup_done(&rev.diffopt);\n+    run_diff_index(&rev,0);\n+    result = write_cache_as_tree(sha1, 0, wt_prefix);","path":"builtin/stash--helper.c","position":46,"original_position":46,"commit_id":"a3111fb934fed088d7d02336f8eb6fe6b35ef91b","original_commit_id":"a3111fb934fed088d7d02336f8eb6fe6b35ef91b","user":{"login":"danilaml","id":2046350,"avatar_url":"https://avatars.githubusercontent.com/u/2046350?v=3","gravatar_id":"","url":"https://api.github.com/users/danilaml","html_url":"https://github.com/danilaml","followers_url":"https://api.github.com/users/danilaml/followers","following_url":"https://api.github.com/users/danilaml/following{/other_user}","gists_url":"https://api.github.com/users/danilaml/gists{/gist_id}","starred_url":"https://api.github.com/users/danilaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danilaml/subscriptions","organizations_url":"https://api.github.com/users/danilaml/orgs","repos_url":"https://api.github.com/users/danilaml/repos","events_url":"https://api.github.com/users/danilaml/events{/privacy}","received_events_url":"https://api.github.com/users/danilaml/received_events","type":"User","site_admin":false},"body":"There are some mixed spaces and tabs in this file.","created_at":"2016-07-02T15:18:41Z","updated_at":"2016-07-02T15:18:41Z","html_url":"https://github.com/git-for-windows/git/pull/508#discussion_r69379167","pull_request_url":"https://api.github.com/repos/git-for-windows/git/pulls/508","_links":{"self":{"href":"https://api.github.com/repos/git-for-windows/git/pulls/comments/69379167"},"html":{"href":"https://github.com/git-for-windows/git/pull/508#discussion_r69379167"},"pull_request":{"href":"https://api.github.com/repos/git-for-windows/git/pulls/508"}}},"pull_request":{"url":"https://api.github.com/repos/git-for-windows/git/pulls/508","id":48588884,"html_url":"https://github.com/git-for-windows/git/pull/508","diff_url":"https://github.com/git-for-windows/git/pull/508.diff","patch_url":"https://github.com/git-for-windows/git/pull/508.patch","issue_url":"https://api.github.com/repos/git-for-windows/git/issues/508","number":508,"state":"open","locked":false,"title":"[RFC]Make stash a builtin","user":{"login":"rimrul","id":6178234,"avatar_url":"https://avatars.githubusercontent.com/u/6178234?v=3","gravatar_id":"","url":"https://api.github.com/users/rimrul","html_url":"https://github.com/rimrul","followers_url":"https://api.github.com/users/rimrul/followers","following_url":"https://api.github.com/users/rimrul/following{/other_user}","gists_url":"https://api.github.com/users/rimrul/gists{/gist_id}","starred_url":"https://api.github.com/users/rimrul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rimrul/subscriptions","organizations_url":"https://api.github.com/users/rimrul/orgs","repos_url":"https://api.github.com/users/rimrul/repos","events_url":"https://api.github.com/users/rimrul/events{/privacy}","received_events_url":"https://api.github.com/users/rimrul/received_events","type":"User","site_admin":false},"body":"This is mainly about e740d9e, the other commits are regular upstream commits.\r\n\r\n>stash--helper: implement \"git stash--helper\"\r\n\r\n>This patch implements a new \"git stash--helper\" builtin plumbing\r\ncommand that will be used to migrate \"git-stash.sh\" to C.\r\n\r\n>We start by implementing only the \"--non-patch\" option that will\r\nhandle the core part of the non-patch stashing.\r\n\r\nThe other commits are in the pull request, because I based this on upstreams master. I want to introduce the stash--helper in another commit with a commit message simillar to 23b5f18 that contains this patch:\r\n\r\n````diff\r\ndiff --git a/git-stash.sh b/git-stash.sh\r\nindex c7c65e2..c0f8b12 100755\r\n--- a/git-stash.sh\r\n+++ b/git-stash.sh\r\n@@ -112,15 +112,9 @@ create_stash () {\r\n \tthen\r\n \r\n \t\t# state of the working tree\r\n-\t\tw_tree=$( (\r\n-\t\t\tgit read-tree --index-output=\"$TMPindex\" -m $i_tree &&\r\n-\t\t\tGIT_INDEX_FILE=\"$TMPindex\" &&\r\n-\t\t\texport GIT_INDEX_FILE &&\r\n-\t\t\tgit diff --name-only -z HEAD -- >\"$TMP-stagenames\" &&\r\n-\t\t\tgit update-index -z --add --remove --stdin <\"$TMP-stagenames\" &&\r\n-\t\t\tgit write-tree &&\r\n-\t\t\trm -f \"$TMPindex\"\r\n-\t\t) ) ||\r\n+\t\tw_tree=$(\r\n+\t\tgit stash--helper --non-patch $TMPindex $TMP-stagenames $i_tree\r\n+\t\t) ||\r\n \t\t\tdie \"$(gettext \"Cannot save the current worktree state\")\"\r\n \r\n \telse\r\n````","created_at":"2015-10-23T14:47:31Z","updated_at":"2016-07-02T15:18:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a7cd70fdc4c821ca2210bf9416617b50781b582","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/git-for-windows/git/pulls/508/commits","review_comments_url":"https://api.github.com/repos/git-for-windows/git/pulls/508/comments","review_comment_url":"https://api.github.com/repos/git-for-windows/git/pulls/comments{/number}","comments_url":"https://api.github.com/repos/git-for-windows/git/issues/508/comments","statuses_url":"https://api.github.com/repos/git-for-windows/git/statuses/a3111fb934fed088d7d02336f8eb6fe6b35ef91b","head":{"label":"rimrul:make-stash-a-builtin","ref":"make-stash-a-builtin","sha":"a3111fb934fed088d7d02336f8eb6fe6b35ef91b","user":{"login":"rimrul","id":6178234,"avatar_url":"https://avatars.githubusercontent.com/u/6178234?v=3","gravatar_id":"","url":"https://api.github.com/users/rimrul","html_url":"https://github.com/rimrul","followers_url":"https://api.github.com/users/rimrul/followers","following_url":"https://api.github.com/users/rimrul/following{/other_user}","gists_url":"https://api.github.com/users/rimrul/gists{/gist_id}","starred_url":"https://api.github.com/users/rimrul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rimrul/subscriptions","organizations_url":"https://api.github.com/users/rimrul/orgs","repos_url":"https://api.github.com/users/rimrul/repos","events_url":"https://api.github.com/users/rimrul/events{/privacy}","received_events_url":"https://api.github.com/users/rimrul/received_events","type":"User","site_admin":false},"repo":{"id":42257060,"name":"git","full_name":"rimrul/git","owner":{"login":"rimrul","id":6178234,"avatar_url":"https://avatars.githubusercontent.com/u/6178234?v=3","gravatar_id":"","url":"https://api.github.com/users/rimrul","html_url":"https://github.com/rimrul","followers_url":"https://api.github.com/users/rimrul/followers","following_url":"https://api.github.com/users/rimrul/following{/other_user}","gists_url":"https://api.github.com/users/rimrul/gists{/gist_id}","starred_url":"https://api.github.com/users/rimrul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rimrul/subscriptions","organizations_url":"https://api.github.com/users/rimrul/orgs","repos_url":"https://api.github.com/users/rimrul/repos","events_url":"https://api.github.com/users/rimrul/events{/privacy}","received_events_url":"https://api.github.com/users/rimrul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rimrul/git","description":"A fork of Git containing Windows-specific patches.","fork":true,"url":"https://api.github.com/repos/rimrul/git","forks_url":"https://api.github.com/repos/rimrul/git/forks","keys_url":"https://api.github.com/repos/rimrul/git/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rimrul/git/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rimrul/git/teams","hooks_url":"https://api.github.com/repos/rimrul/git/hooks","issue_events_url":"https://api.github.com/repos/rimrul/git/issues/events{/number}","events_url":"https://api.github.com/repos/rimrul/git/events","assignees_url":"https://api.github.com/repos/rimrul/git/assignees{/user}","branches_url":"https://api.github.com/repos/rimrul/git/branches{/branch}","tags_url":"https://api.github.com/repos/rimrul/git/tags","blobs_url":"https://api.github.com/repos/rimrul/git/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rimrul/git/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rimrul/git/git/refs{/sha}","trees_url":"https://api.github.com/repos/rimrul/git/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rimrul/git/statuses/{sha}","languages_url":"https://api.github.com/repos/rimrul/git/languages","stargazers_url":"https://api.github.com/repos/rimrul/git/stargazers","contributors_url":"https://api.github.com/repos/rimrul/git/contributors","subscribers_url":"https://api.github.com/repos/rimrul/git/subscribers","subscription_url":"https://api.github.com/repos/rimrul/git/subscription","commits_url":"https://api.github.com/repos/rimrul/git/commits{/sha}","git_commits_url":"https://api.github.com/repos/rimrul/git/git/commits{/sha}","comments_url":"https://api.github.com/repos/rimrul/git/comments{/number}","issue_comment_url":"https://api.github.com/repos/rimrul/git/issues/comments{/number}","contents_url":"https://api.github.com/repos/rimrul/git/contents/{+path}","compare_url":"https://api.github.com/repos/rimrul/git/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rimrul/git/merges","archive_url":"https://api.github.com/repos/rimrul/git/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rimrul/git/downloads","issues_url":"https://api.github.com/repos/rimrul/git/issues{/number}","pulls_url":"https://api.github.com/repos/rimrul/git/pulls{/number}","milestones_url":"https://api.github.com/repos/rimrul/git/milestones{/number}","notifications_url":"https://api.github.com/repos/rimrul/git/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rimrul/git/labels{/name}","releases_url":"https://api.github.com/repos/rimrul/git/releases{/id}","deployments_url":"https://api.github.com/repos/rimrul/git/deployments","created_at":"2015-09-10T16:39:10Z","updated_at":"2016-04-02T16:21:51Z","pushed_at":"2016-06-30T21:11:37Z","git_url":"git://github.com/rimrul/git.git","ssh_url":"git@github.com:rimrul/git.git","clone_url":"https://github.com/rimrul/git.git","svn_url":"https://github.com/rimrul/git","homepage":"http://git-scm.com/","size":106306,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"git-for-windows:master","ref":"master","sha":"ac008b30ec070f459450d602c55d55816aae2915","user":{"login":"git-for-windows","id":4571183,"avatar_url":"https://avatars.githubusercontent.com/u/4571183?v=3","gravatar_id":"","url":"https://api.github.com/users/git-for-windows","html_url":"https://github.com/git-for-windows","followers_url":"https://api.github.com/users/git-for-windows/followers","following_url":"https://api.github.com/users/git-for-windows/following{/other_user}","gists_url":"https://api.github.com/users/git-for-windows/gists{/gist_id}","starred_url":"https://api.github.com/users/git-for-windows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/git-for-windows/subscriptions","organizations_url":"https://api.github.com/users/git-for-windows/orgs","repos_url":"https://api.github.com/users/git-for-windows/repos","events_url":"https://api.github.com/users/git-for-windows/events{/privacy}","received_events_url":"https://api.github.com/users/git-for-windows/received_events","type":"Organization","site_admin":false},"repo":{"id":23216272,"name":"git","full_name":"git-for-windows/git","owner":{"login":"git-for-windows","id":4571183,"avatar_url":"https://avatars.githubusercontent.com/u/4571183?v=3","gravatar_id":"","url":"https://api.github.com/users/git-for-windows","html_url":"https://github.com/git-for-windows","followers_url":"https://api.github.com/users/git-for-windows/followers","following_url":"https://api.github.com/users/git-for-windows/following{/other_user}","gists_url":"https://api.github.com/users/git-for-windows/gists{/gist_id}","starred_url":"https://api.github.com/users/git-for-windows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/git-for-windows/subscriptions","organizations_url":"https://api.github.com/users/git-for-windows/orgs","repos_url":"https://api.github.com/users/git-for-windows/repos","events_url":"https://api.github.com/users/git-for-windows/events{/privacy}","received_events_url":"https://api.github.com/users/git-for-windows/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/git-for-windows/git","description":"A fork of Git containing Windows-specific patches.","fork":true,"url":"https://api.github.com/repos/git-for-windows/git","forks_url":"https://api.github.com/repos/git-for-windows/git/forks","keys_url":"https://api.github.com/repos/git-for-windows/git/keys{/key_id}","collaborators_url":"https://api.github.com/repos/git-for-windows/git/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/git-for-windows/git/teams","hooks_url":"https://api.github.com/repos/git-for-windows/git/hooks","issue_events_url":"https://api.github.com/repos/git-for-windows/git/issues/events{/number}","events_url":"https://api.github.com/repos/git-for-windows/git/events","assignees_url":"https://api.github.com/repos/git-for-windows/git/assignees{/user}","branches_url":"https://api.github.com/repos/git-for-windows/git/branches{/branch}","tags_url":"https://api.github.com/repos/git-for-windows/git/tags","blobs_url":"https://api.github.com/repos/git-for-windows/git/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/git-for-windows/git/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/git-for-windows/git/git/refs{/sha}","trees_url":"https://api.github.com/repos/git-for-windows/git/git/trees{/sha}","statuses_url":"https://api.github.com/repos/git-for-windows/git/statuses/{sha}","languages_url":"https://api.github.com/repos/git-for-windows/git/languages","stargazers_url":"https://api.github.com/repos/git-for-windows/git/stargazers","contributors_url":"https://api.github.com/repos/git-for-windows/git/contributors","subscribers_url":"https://api.github.com/repos/git-for-windows/git/subscribers","subscription_url":"https://api.github.com/repos/git-for-windows/git/subscription","commits_url":"https://api.github.com/repos/git-for-windows/git/commits{/sha}","git_commits_url":"https://api.github.com/repos/git-for-windows/git/git/commits{/sha}","comments_url":"https://api.github.com/repos/git-for-windows/git/comments{/number}","issue_comment_url":"https://api.github.com/repos/git-for-windows/git/issues/comments{/number}","contents_url":"https://api.github.com/repos/git-for-windows/git/contents/{+path}","compare_url":"https://api.github.com/repos/git-for-windows/git/compare/{base}...{head}","merges_url":"https://api.github.com/repos/git-for-windows/git/merges","archive_url":"https://api.github.com/repos/git-for-windows/git/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/git-for-windows/git/downloads","issues_url":"https://api.github.com/repos/git-for-windows/git/issues{/number}","pulls_url":"https://api.github.com/repos/git-for-windows/git/pulls{/number}","milestones_url":"https://api.github.com/repos/git-for-windows/git/milestones{/number}","notifications_url":"https://api.github.com/repos/git-for-windows/git/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/git-for-windows/git/labels{/name}","releases_url":"https://api.github.com/repos/git-for-windows/git/releases{/id}","deployments_url":"https://api.github.com/repos/git-for-windows/git/deployments","created_at":"2014-08-22T07:07:36Z","updated_at":"2016-07-01T21:22:53Z","pushed_at":"2016-06-30T21:11:41Z","git_url":"git://github.com/git-for-windows/git.git","ssh_url":"git@github.com:git-for-windows/git.git","clone_url":"https://github.com/git-for-windows/git.git","svn_url":"https://github.com/git-for-windows/git","homepage":"http://git-scm.com/","size":135414,"stargazers_count":1855,"watchers_count":1855,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":384,"mirror_url":null,"open_issues_count":80,"forks":384,"open_issues":80,"watchers":1855,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/git-for-windows/git/pulls/508"},"html":{"href":"https://github.com/git-for-windows/git/pull/508"},"issue":{"href":"https://api.github.com/repos/git-for-windows/git/issues/508"},"comments":{"href":"https://api.github.com/repos/git-for-windows/git/issues/508/comments"},"review_comments":{"href":"https://api.github.com/repos/git-for-windows/git/pulls/508/comments"},"review_comment":{"href":"https://api.github.com/repos/git-for-windows/git/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/git-for-windows/git/pulls/508/commits"},"statuses":{"href":"https://api.github.com/repos/git-for-windows/git/statuses/a3111fb934fed088d7d02336f8eb6fe6b35ef91b"}}}}
{"actor":{"display_login":"danilaml"}}