{"action":"created","comment":{"url":"https://api.github.com/repos/docker/docker/pulls/comments/85830617","pull_request_review_id":6522854,"id":85830617,"diff_hunk":"@@ -536,8 +540,27 @@ func (d *Driver) Exists(id string) bool {\n \treturn err == nil\n }\n \n+// isParent returns if the passed in parent is the direct parent of the passed in layer\n+func (d *Driver) isParent(id, parent string) bool {\n+\tlowers, err := d.getLowerDirs(id)\n+\tif err != nil {\n+\t\treturn false\n+\t}\n+\tparentDir := d.dir(parent)\n+\tvar ld string\n+\tif len(lowers) > 0 {\n+\t\tld = filepath.Dir(lowers[0])\n+\t}\n+\treturn ld == parentDir\n+}\n+\n // ApplyDiff applies the new layer into a root\n func (d *Driver) ApplyDiff(id string, parent string, diff io.Reader) (size int64, err error) {\n+\tif parent != \"\" && !d.isParent(id, parent) {\n+\t\tlogrus.Debugf(\"using naive diff for ApplyDiff id: %s, parent: %s\", id, parent)","path":"daemon/graphdriver/overlay2/overlay.go","position":76,"original_position":76,"commit_id":"e66e8cd74dc17882378fe994860cfa6fe4fe8f01","original_commit_id":"e66e8cd74dc17882378fe994860cfa6fe4fe8f01","user":{"login":"crosbymichael","id":749551,"avatar_url":"https://avatars.githubusercontent.com/u/749551?v=3","gravatar_id":"","url":"https://api.github.com/users/crosbymichael","html_url":"https://github.com/crosbymichael","followers_url":"https://api.github.com/users/crosbymichael/followers","following_url":"https://api.github.com/users/crosbymichael/following{/other_user}","gists_url":"https://api.github.com/users/crosbymichael/gists{/gist_id}","starred_url":"https://api.github.com/users/crosbymichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crosbymichael/subscriptions","organizations_url":"https://api.github.com/users/crosbymichael/orgs","repos_url":"https://api.github.com/users/crosbymichael/repos","events_url":"https://api.github.com/users/crosbymichael/events{/privacy}","received_events_url":"https://api.github.com/users/crosbymichael/received_events","type":"User","site_admin":false},"body":"I'm not a fan of all the debug messages in the graph drivers.  Our debug logs are already super verbose without adding much in a production setting.\r\n\r\nThis is useful for development on this feature but I think we should remove them now  ","created_at":"2016-10-31T20:53:59Z","updated_at":"2016-10-31T20:59:17Z","html_url":"https://github.com/docker/docker/pull/22641#discussion_r85830617","pull_request_url":"https://api.github.com/repos/docker/docker/pulls/22641","_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/comments/85830617"},"html":{"href":"https://github.com/docker/docker/pull/22641#discussion_r85830617"},"pull_request":{"href":"https://api.github.com/repos/docker/docker/pulls/22641"}}},"pull_request":{"url":"https://api.github.com/repos/docker/docker/pulls/22641","id":69572628,"html_url":"https://github.com/docker/docker/pull/22641","diff_url":"https://github.com/docker/docker/pull/22641.diff","patch_url":"https://github.com/docker/docker/pull/22641.patch","issue_url":"https://api.github.com/repos/docker/docker/issues/22641","number":22641,"state":"open","locked":false,"title":"Adds ability to flatten image after build","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"body":"<!--\r\nPlease make sure you've read and understood our contributing guidelines;\r\nhttps://github.com/docker/docker/blob/master/CONTRIBUTING.md\r\n\r\n** Make sure all your commits include a signature generated with `git commit -s` **\r\n\r\nFor additional information on our contributing process, read our contributing\r\nguide https://docs.docker.com/opensource/code/\r\n\r\nIf this is a bug fix, make sure your description includes \"fixes #xxxx\", or\r\n\"closes #xxxx\"\r\n\r\nPlease provide the following information:\r\n-->\r\n\r\n**\\- What I did**\r\nAllow built images to be squashed to their parent.\r\nSquashing does not destroy any images or layers, and preserves the build cache.\r\n\r\n**\\- How I did it**\r\nIntroduce a new CLI argument `--squash` to `docker build`.\r\nIntroduce a new param to the build API endpoint `squash`.\r\n\r\nOnce the build is complete, docker creates a new image loading the diffs from each layer into a single new layer and references all the parent's layers\r\n\r\n**\\- How to verify it**\r\n\r\n``` Dockerfile\r\nFROM busybox\r\nRUN echo hello > /hello\r\nRUN echo world >> /hello\r\nRUN touch remove_me /remove_me\r\nENV HELLO world\r\nRUN rm /remove_me\r\n```\r\n\r\n```\r\n$ docker build -t test squash .\r\n...\r\n$ docker history test\r\nIMAGE               CREATED             CREATED BY                                      SIZE                COMMENT\r\n4e10cb5b4cac        3 seconds ago                                                       12 B                merge sha256:88a7b0112a41826885df0e7072698006ee8f621c6ab99fca7fe9151d7b599702 to sha256:47bcc53f74dc94b1920f0b34f6036096526296767650f223433fe65c35f149eb\r\n<missing>           5 minutes ago       /bin/sh -c rm /remove_me                        0 B\r\n<missing>           5 minutes ago       /bin/sh -c #(nop) ENV HELLO=world               0 B\r\n<missing>           5 minutes ago       /bin/sh -c touch remove_me /remove_me           0 B\r\n<missing>           5 minutes ago       /bin/sh -c echo world >> /hello                 0 B\r\n<missing>           6 minutes ago       /bin/sh -c echo hello > /hello                  0 B\r\n<missing>           7 weeks ago         /bin/sh -c #(nop) CMD [\"sh\"]                    0 B\r\n<missing>           7 weeks ago         /bin/sh -c #(nop) ADD file:47ca6e777c36a4cfff   1.113 MB\r\n```\r\n\r\nTest the image, check for `/remove_me` being gone, make sure `hello\\nworld` is in `/hello`, make sure the `HELLO` envvar's value is `world`\r\n\r\n**\\- Description for the changelog**\r\n\r\n<!--\r\nWrite a short (one line) summary that describes the changes in this\r\npull request for inclusion in the changelog:\r\n-->\r\n\r\nAdd option to squash image layers to the `FROM` image after successful builds\r\n\r\n**\\- A picture of a cute animal (not mandatory but encouraged)**\r\n![](http://www.southernsavers.com/wp-content/uploads/2012/03/build-a-bear-coupon.jpg)\r\n\r\nSome of the implementation is a little rough around the edges but wanted to get this out there.\r\nI also really wanted to make sure that when using the `full` option the user is prompted to make sure they know what it's really doing.\r\n","created_at":"2016-05-10T20:31:04Z","updated_at":"2016-10-31T20:59:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00afe45f9120d06c572b61ec15bd119325ca997b","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/docker/docker/milestones/56","html_url":"https://github.com/docker/docker/milestones/1.13.0","labels_url":"https://api.github.com/repos/docker/docker/milestones/56/labels","id":1839404,"number":56,"title":"1.13.0","description":"","creator":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars.githubusercontent.com/u/1804568?v=3","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"open_issues":117,"closed_issues":526,"state":"open","created_at":"2016-06-20T22:51:25Z","updated_at":"2016-10-31T20:39:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/docker/docker/pulls/22641/commits","review_comments_url":"https://api.github.com/repos/docker/docker/pulls/22641/comments","review_comment_url":"https://api.github.com/repos/docker/docker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/docker/issues/22641/comments","statuses_url":"https://api.github.com/repos/docker/docker/statuses/e66e8cd74dc17882378fe994860cfa6fe4fe8f01","head":{"label":"cpuguy83:build_finalization","ref":"build_finalization","sha":"e66e8cd74dc17882378fe994860cfa6fe4fe8f01","user":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"repo":{"id":15300899,"name":"docker","full_name":"cpuguy83/docker","owner":{"login":"cpuguy83","id":799078,"avatar_url":"https://avatars.githubusercontent.com/u/799078?v=3","gravatar_id":"","url":"https://api.github.com/users/cpuguy83","html_url":"https://github.com/cpuguy83","followers_url":"https://api.github.com/users/cpuguy83/followers","following_url":"https://api.github.com/users/cpuguy83/following{/other_user}","gists_url":"https://api.github.com/users/cpuguy83/gists{/gist_id}","starred_url":"https://api.github.com/users/cpuguy83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpuguy83/subscriptions","organizations_url":"https://api.github.com/users/cpuguy83/orgs","repos_url":"https://api.github.com/users/cpuguy83/repos","events_url":"https://api.github.com/users/cpuguy83/events{/privacy}","received_events_url":"https://api.github.com/users/cpuguy83/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cpuguy83/docker","description":"Docker - the open-source application container engine","fork":true,"url":"https://api.github.com/repos/cpuguy83/docker","forks_url":"https://api.github.com/repos/cpuguy83/docker/forks","keys_url":"https://api.github.com/repos/cpuguy83/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cpuguy83/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cpuguy83/docker/teams","hooks_url":"https://api.github.com/repos/cpuguy83/docker/hooks","issue_events_url":"https://api.github.com/repos/cpuguy83/docker/issues/events{/number}","events_url":"https://api.github.com/repos/cpuguy83/docker/events","assignees_url":"https://api.github.com/repos/cpuguy83/docker/assignees{/user}","branches_url":"https://api.github.com/repos/cpuguy83/docker/branches{/branch}","tags_url":"https://api.github.com/repos/cpuguy83/docker/tags","blobs_url":"https://api.github.com/repos/cpuguy83/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cpuguy83/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cpuguy83/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/cpuguy83/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cpuguy83/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/cpuguy83/docker/languages","stargazers_url":"https://api.github.com/repos/cpuguy83/docker/stargazers","contributors_url":"https://api.github.com/repos/cpuguy83/docker/contributors","subscribers_url":"https://api.github.com/repos/cpuguy83/docker/subscribers","subscription_url":"https://api.github.com/repos/cpuguy83/docker/subscription","commits_url":"https://api.github.com/repos/cpuguy83/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/cpuguy83/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/cpuguy83/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/cpuguy83/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/cpuguy83/docker/contents/{+path}","compare_url":"https://api.github.com/repos/cpuguy83/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cpuguy83/docker/merges","archive_url":"https://api.github.com/repos/cpuguy83/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cpuguy83/docker/downloads","issues_url":"https://api.github.com/repos/cpuguy83/docker/issues{/number}","pulls_url":"https://api.github.com/repos/cpuguy83/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/cpuguy83/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/cpuguy83/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cpuguy83/docker/labels{/name}","releases_url":"https://api.github.com/repos/cpuguy83/docker/releases{/id}","deployments_url":"https://api.github.com/repos/cpuguy83/docker/deployments","created_at":"2013-12-19T02:58:40Z","updated_at":"2015-04-27T13:11:12Z","pushed_at":"2016-10-31T19:59:07Z","git_url":"git://github.com/cpuguy83/docker.git","ssh_url":"git@github.com:cpuguy83/docker.git","clone_url":"https://github.com/cpuguy83/docker.git","svn_url":"https://github.com/cpuguy83/docker","homepage":"http://www.docker.io","size":108305,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"2fc760496b24cc1d42d5527ec593b0e1b1701d54","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":7691631,"name":"docker","full_name":"docker/docker","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/docker","description":"Docker - the open-source application container engine","fork":false,"url":"https://api.github.com/repos/docker/docker","forks_url":"https://api.github.com/repos/docker/docker/forks","keys_url":"https://api.github.com/repos/docker/docker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/docker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/docker/teams","hooks_url":"https://api.github.com/repos/docker/docker/hooks","issue_events_url":"https://api.github.com/repos/docker/docker/issues/events{/number}","events_url":"https://api.github.com/repos/docker/docker/events","assignees_url":"https://api.github.com/repos/docker/docker/assignees{/user}","branches_url":"https://api.github.com/repos/docker/docker/branches{/branch}","tags_url":"https://api.github.com/repos/docker/docker/tags","blobs_url":"https://api.github.com/repos/docker/docker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/docker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/docker/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/docker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/docker/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/docker/languages","stargazers_url":"https://api.github.com/repos/docker/docker/stargazers","contributors_url":"https://api.github.com/repos/docker/docker/contributors","subscribers_url":"https://api.github.com/repos/docker/docker/subscribers","subscription_url":"https://api.github.com/repos/docker/docker/subscription","commits_url":"https://api.github.com/repos/docker/docker/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/docker/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/docker/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/docker/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/docker/contents/{+path}","compare_url":"https://api.github.com/repos/docker/docker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/docker/merges","archive_url":"https://api.github.com/repos/docker/docker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/docker/downloads","issues_url":"https://api.github.com/repos/docker/docker/issues{/number}","pulls_url":"https://api.github.com/repos/docker/docker/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/docker/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/docker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/docker/labels{/name}","releases_url":"https://api.github.com/repos/docker/docker/releases{/id}","deployments_url":"https://api.github.com/repos/docker/docker/deployments","created_at":"2013-01-18T18:10:57Z","updated_at":"2016-10-31T20:33:20Z","pushed_at":"2016-10-31T20:51:24Z","git_url":"git://github.com/docker/docker.git","ssh_url":"git@github.com:docker/docker.git","clone_url":"https://github.com/docker/docker.git","svn_url":"https://github.com/docker/docker","homepage":"http://www.docker.com","size":216646,"stargazers_count":36453,"watchers_count":36453,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10753,"mirror_url":null,"open_issues_count":1866,"forks":10753,"open_issues":1866,"watchers":36453,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/docker/pulls/22641"},"html":{"href":"https://github.com/docker/docker/pull/22641"},"issue":{"href":"https://api.github.com/repos/docker/docker/issues/22641"},"comments":{"href":"https://api.github.com/repos/docker/docker/issues/22641/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/docker/pulls/22641/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/docker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/docker/pulls/22641/commits"},"statuses":{"href":"https://api.github.com/repos/docker/docker/statuses/e66e8cd74dc17882378fe994860cfa6fe4fe8f01"}}}}
{"actor":{"display_login":"crosbymichael"}}