{"action":"closed","number":2425,"pull_request":{"url":"https://api.github.com/repos/cfengine/core/pulls/2425","id":52546585,"html_url":"https://github.com/cfengine/core/pull/2425","diff_url":"https://github.com/cfengine/core/pull/2425.diff","patch_url":"https://github.com/cfengine/core/pull/2425.patch","issue_url":"https://api.github.com/repos/cfengine/core/issues/2425","number":2425,"state":"closed","locked":false,"title":"Add \"canonify\" mode to mapdata().","user":{"login":"tzz","id":67764,"avatar_url":"https://avatars.githubusercontent.com/u/67764?v=3","gravatar_id":"","url":"https://api.github.com/users/tzz","html_url":"https://github.com/tzz","followers_url":"https://api.github.com/users/tzz/followers","following_url":"https://api.github.com/users/tzz/following{/other_user}","gists_url":"https://api.github.com/users/tzz/gists{/gist_id}","starred_url":"https://api.github.com/users/tzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzz/subscriptions","organizations_url":"https://api.github.com/users/tzz/orgs","repos_url":"https://api.github.com/users/tzz/repos","events_url":"https://api.github.com/users/tzz/events{/privacy}","received_events_url":"https://api.github.com/users/tzz/received_events","type":"User","site_admin":false},"body":"This change includes acceptance tests, showing usage and effect.\r\n\r\nIt addresses a very common need: canonify a list without intermediate arrays.  See https://dev.cfengine.com/issues/2377 for one of many requests for it.\r\n\r\nSyntax:\r\n```\r\n\"canonified\" data => mapdata(\"canonify\", \"any use of $(this.k) and $(this.v)\", any_list_or_container_var);\r\n```\r\n\r\nThis is 100% backwards compatible and very safe.  Please consider merging to 3.7 and 3.8 as well, even though it's a feature.\r\n\r\nIn addition to implementing the feature, this PR:\r\n\r\n* adds a general `BufferCanonify` function to simplify code\r\n* adds a note to `CanonifyName` (which has a `CF_BUFSIZE` limitation) that it should be replaced with `BufferCanonify` or `CanonifyNameInPlace`\r\n* moves `CanonifyNameInPlace` to `string_lib.[ch]` because it's more appropriate there instead of `files_names.[ch]`\r\n* fixed the doc of `BufferRewrite` because it doesn't return anything\r\n","created_at":"2015-12-03T15:13:30Z","updated_at":"2015-12-29T08:18:22Z","closed_at":"2015-12-29T08:18:22Z","merged_at":"2015-12-29T08:18:22Z","merge_commit_sha":"1be839237e234971a44e218fafa7547a930f96e2","assignee":{"login":"kacf","id":4037094,"avatar_url":"https://avatars.githubusercontent.com/u/4037094?v=3","gravatar_id":"","url":"https://api.github.com/users/kacf","html_url":"https://github.com/kacf","followers_url":"https://api.github.com/users/kacf/followers","following_url":"https://api.github.com/users/kacf/following{/other_user}","gists_url":"https://api.github.com/users/kacf/gists{/gist_id}","starred_url":"https://api.github.com/users/kacf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacf/subscriptions","organizations_url":"https://api.github.com/users/kacf/orgs","repos_url":"https://api.github.com/users/kacf/repos","events_url":"https://api.github.com/users/kacf/events{/privacy}","received_events_url":"https://api.github.com/users/kacf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cfengine/core/pulls/2425/commits","review_comments_url":"https://api.github.com/repos/cfengine/core/pulls/2425/comments","review_comment_url":"https://api.github.com/repos/cfengine/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfengine/core/issues/2425/comments","statuses_url":"https://api.github.com/repos/cfengine/core/statuses/d0361aa51824ae71184558ab66df64d6da5d2c12","head":{"label":"tzz:feature/mapdata/canonify","ref":"feature/mapdata/canonify","sha":"d0361aa51824ae71184558ab66df64d6da5d2c12","user":{"login":"tzz","id":67764,"avatar_url":"https://avatars.githubusercontent.com/u/67764?v=3","gravatar_id":"","url":"https://api.github.com/users/tzz","html_url":"https://github.com/tzz","followers_url":"https://api.github.com/users/tzz/followers","following_url":"https://api.github.com/users/tzz/following{/other_user}","gists_url":"https://api.github.com/users/tzz/gists{/gist_id}","starred_url":"https://api.github.com/users/tzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzz/subscriptions","organizations_url":"https://api.github.com/users/tzz/orgs","repos_url":"https://api.github.com/users/tzz/repos","events_url":"https://api.github.com/users/tzz/events{/privacy}","received_events_url":"https://api.github.com/users/tzz/received_events","type":"User","site_admin":false},"repo":{"id":5155224,"name":"core","full_name":"tzz/core","owner":{"login":"tzz","id":67764,"avatar_url":"https://avatars.githubusercontent.com/u/67764?v=3","gravatar_id":"","url":"https://api.github.com/users/tzz","html_url":"https://github.com/tzz","followers_url":"https://api.github.com/users/tzz/followers","following_url":"https://api.github.com/users/tzz/following{/other_user}","gists_url":"https://api.github.com/users/tzz/gists{/gist_id}","starred_url":"https://api.github.com/users/tzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzz/subscriptions","organizations_url":"https://api.github.com/users/tzz/orgs","repos_url":"https://api.github.com/users/tzz/repos","events_url":"https://api.github.com/users/tzz/events{/privacy}","received_events_url":"https://api.github.com/users/tzz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tzz/core","description":"CFEngine Community","fork":true,"url":"https://api.github.com/repos/tzz/core","forks_url":"https://api.github.com/repos/tzz/core/forks","keys_url":"https://api.github.com/repos/tzz/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tzz/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tzz/core/teams","hooks_url":"https://api.github.com/repos/tzz/core/hooks","issue_events_url":"https://api.github.com/repos/tzz/core/issues/events{/number}","events_url":"https://api.github.com/repos/tzz/core/events","assignees_url":"https://api.github.com/repos/tzz/core/assignees{/user}","branches_url":"https://api.github.com/repos/tzz/core/branches{/branch}","tags_url":"https://api.github.com/repos/tzz/core/tags","blobs_url":"https://api.github.com/repos/tzz/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tzz/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tzz/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/tzz/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tzz/core/statuses/{sha}","languages_url":"https://api.github.com/repos/tzz/core/languages","stargazers_url":"https://api.github.com/repos/tzz/core/stargazers","contributors_url":"https://api.github.com/repos/tzz/core/contributors","subscribers_url":"https://api.github.com/repos/tzz/core/subscribers","subscription_url":"https://api.github.com/repos/tzz/core/subscription","commits_url":"https://api.github.com/repos/tzz/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/tzz/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/tzz/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/tzz/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/tzz/core/contents/{+path}","compare_url":"https://api.github.com/repos/tzz/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tzz/core/merges","archive_url":"https://api.github.com/repos/tzz/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tzz/core/downloads","issues_url":"https://api.github.com/repos/tzz/core/issues{/number}","pulls_url":"https://api.github.com/repos/tzz/core/pulls{/number}","milestones_url":"https://api.github.com/repos/tzz/core/milestones{/number}","notifications_url":"https://api.github.com/repos/tzz/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tzz/core/labels{/name}","releases_url":"https://api.github.com/repos/tzz/core/releases{/id}","created_at":"2012-07-23T17:54:47Z","updated_at":"2014-06-24T13:51:12Z","pushed_at":"2015-12-28T23:16:55Z","git_url":"git://github.com/tzz/core.git","ssh_url":"git@github.com:tzz/core.git","clone_url":"https://github.com/tzz/core.git","svn_url":"https://github.com/tzz/core","homepage":"https://cfengine.com/community/","size":51807,"stargazers_count":1,"watchers_count":1,"language":"C","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":1,"default_branch":"master"}},"base":{"label":"cfengine:master","ref":"master","sha":"95af23aaabb77dabf0b354b5a46422921194dfa5","user":{"login":"cfengine","id":1239823,"avatar_url":"https://avatars.githubusercontent.com/u/1239823?v=3","gravatar_id":"","url":"https://api.github.com/users/cfengine","html_url":"https://github.com/cfengine","followers_url":"https://api.github.com/users/cfengine/followers","following_url":"https://api.github.com/users/cfengine/following{/other_user}","gists_url":"https://api.github.com/users/cfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/cfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfengine/subscriptions","organizations_url":"https://api.github.com/users/cfengine/orgs","repos_url":"https://api.github.com/users/cfengine/repos","events_url":"https://api.github.com/users/cfengine/events{/privacy}","received_events_url":"https://api.github.com/users/cfengine/received_events","type":"Organization","site_admin":false},"repo":{"id":3543548,"name":"core","full_name":"cfengine/core","owner":{"login":"cfengine","id":1239823,"avatar_url":"https://avatars.githubusercontent.com/u/1239823?v=3","gravatar_id":"","url":"https://api.github.com/users/cfengine","html_url":"https://github.com/cfengine","followers_url":"https://api.github.com/users/cfengine/followers","following_url":"https://api.github.com/users/cfengine/following{/other_user}","gists_url":"https://api.github.com/users/cfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/cfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfengine/subscriptions","organizations_url":"https://api.github.com/users/cfengine/orgs","repos_url":"https://api.github.com/users/cfengine/repos","events_url":"https://api.github.com/users/cfengine/events{/privacy}","received_events_url":"https://api.github.com/users/cfengine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfengine/core","description":"CFEngine Community","fork":false,"url":"https://api.github.com/repos/cfengine/core","forks_url":"https://api.github.com/repos/cfengine/core/forks","keys_url":"https://api.github.com/repos/cfengine/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfengine/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfengine/core/teams","hooks_url":"https://api.github.com/repos/cfengine/core/hooks","issue_events_url":"https://api.github.com/repos/cfengine/core/issues/events{/number}","events_url":"https://api.github.com/repos/cfengine/core/events","assignees_url":"https://api.github.com/repos/cfengine/core/assignees{/user}","branches_url":"https://api.github.com/repos/cfengine/core/branches{/branch}","tags_url":"https://api.github.com/repos/cfengine/core/tags","blobs_url":"https://api.github.com/repos/cfengine/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfengine/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfengine/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfengine/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfengine/core/statuses/{sha}","languages_url":"https://api.github.com/repos/cfengine/core/languages","stargazers_url":"https://api.github.com/repos/cfengine/core/stargazers","contributors_url":"https://api.github.com/repos/cfengine/core/contributors","subscribers_url":"https://api.github.com/repos/cfengine/core/subscribers","subscription_url":"https://api.github.com/repos/cfengine/core/subscription","commits_url":"https://api.github.com/repos/cfengine/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfengine/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfengine/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfengine/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfengine/core/contents/{+path}","compare_url":"https://api.github.com/repos/cfengine/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfengine/core/merges","archive_url":"https://api.github.com/repos/cfengine/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfengine/core/downloads","issues_url":"https://api.github.com/repos/cfengine/core/issues{/number}","pulls_url":"https://api.github.com/repos/cfengine/core/pulls{/number}","milestones_url":"https://api.github.com/repos/cfengine/core/milestones{/number}","notifications_url":"https://api.github.com/repos/cfengine/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfengine/core/labels{/name}","releases_url":"https://api.github.com/repos/cfengine/core/releases{/id}","created_at":"2012-02-25T09:19:05Z","updated_at":"2015-12-17T08:13:20Z","pushed_at":"2015-12-29T08:18:22Z","git_url":"git://github.com/cfengine/core.git","ssh_url":"git@github.com:cfengine/core.git","clone_url":"https://github.com/cfengine/core.git","svn_url":"https://github.com/cfengine/core","homepage":"https://cfengine.com/community/","size":58423,"stargazers_count":228,"watchers_count":228,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":143,"mirror_url":null,"open_issues_count":20,"forks":143,"open_issues":20,"watchers":228,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfengine/core/pulls/2425"},"html":{"href":"https://github.com/cfengine/core/pull/2425"},"issue":{"href":"https://api.github.com/repos/cfengine/core/issues/2425"},"comments":{"href":"https://api.github.com/repos/cfengine/core/issues/2425/comments"},"review_comments":{"href":"https://api.github.com/repos/cfengine/core/pulls/2425/comments"},"review_comment":{"href":"https://api.github.com/repos/cfengine/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfengine/core/pulls/2425/commits"},"statuses":{"href":"https://api.github.com/repos/cfengine/core/statuses/d0361aa51824ae71184558ab66df64d6da5d2c12"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"kacf","id":4037094,"avatar_url":"https://avatars.githubusercontent.com/u/4037094?v=3","gravatar_id":"","url":"https://api.github.com/users/kacf","html_url":"https://github.com/kacf","followers_url":"https://api.github.com/users/kacf/followers","following_url":"https://api.github.com/users/kacf/following{/other_user}","gists_url":"https://api.github.com/users/kacf/gists{/gist_id}","starred_url":"https://api.github.com/users/kacf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacf/subscriptions","organizations_url":"https://api.github.com/users/kacf/orgs","repos_url":"https://api.github.com/users/kacf/repos","events_url":"https://api.github.com/users/kacf/events{/privacy}","received_events_url":"https://api.github.com/users/kacf/received_events","type":"User","site_admin":false},"comments":10,"review_comments":0,"commits":1,"additions":140,"deletions":18,"changed_files":9}}