{"action":"created","comment":{"url":"https://api.github.com/repos/cfengine/core/pulls/comments/33678842","id":33678842,"diff_hunk":"@@ -809,21 +809,40 @@ static bool GeneratePolicyReleaseIDFromGit(char *release_id_out,\n     snprintf(git_filename, PATH_MAX, \"%s/.git/HEAD\", policy_dir);\n     MapName(git_filename);\n \n+    // Note: Probably we should not be reading all of these filenames directly,\n+    // and should instead use git plumbing commands to retrieve the data.\n     FILE *git_file = fopen(git_filename, \"r\");\n     if (git_file)\n     {\n         char git_head[128];\n         int scanned = fscanf(git_file, \"ref: %127s\", git_head);\n-        fclose(git_file);\n \n         if (scanned == 1)\n+        // Found HEAD Reference which means we are on a checked out branch\n         {\n+            fclose(git_file);\n             snprintf(git_filename, PATH_MAX, \"%s/.git/%s\", policy_dir, git_head);\n             git_file = fopen(git_filename, \"r\");\n+            Log(LOG_LEVEL_DEBUG, \"Found a git HEAD ref\");\n         }\n         else\n         {\n-            git_file = NULL;\n+            Log(LOG_LEVEL_DEBUG, \"Unable to find HEAD ref in %s. Looking for commit\", git_file);","path":"libpromises/generic_agent.c","position":24,"original_position":24,"commit_id":"8754487bc51d1b5e84eec2814889373ecb656e57","original_commit_id":"8754487bc51d1b5e84eec2814889373ecb656e57","user":{"login":"jimis","id":3584514,"avatar_url":"https://avatars.githubusercontent.com/u/3584514?v=3","gravatar_id":"","url":"https://api.github.com/users/jimis","html_url":"https://github.com/jimis","followers_url":"https://api.github.com/users/jimis/followers","following_url":"https://api.github.com/users/jimis/following{/other_user}","gists_url":"https://api.github.com/users/jimis/gists{/gist_id}","starred_url":"https://api.github.com/users/jimis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimis/subscriptions","organizations_url":"https://api.github.com/users/jimis/orgs","repos_url":"https://api.github.com/users/jimis/repos","events_url":"https://api.github.com/users/jimis/events{/privacy}","received_events_url":"https://api.github.com/users/jimis/received_events","type":"User","site_admin":false},"body":"s/`git_file`/`git_filename`/\r\n\r\nI'll commit a quick fix.","created_at":"2015-07-01T13:43:02Z","updated_at":"2015-07-01T13:43:02Z","html_url":"https://github.com/cfengine/core/pull/2257#discussion_r33678842","pull_request_url":"https://api.github.com/repos/cfengine/core/pulls/2257","_links":{"self":{"href":"https://api.github.com/repos/cfengine/core/pulls/comments/33678842"},"html":{"href":"https://github.com/cfengine/core/pull/2257#discussion_r33678842"},"pull_request":{"href":"https://api.github.com/repos/cfengine/core/pulls/2257"}}},"pull_request":{"url":"https://api.github.com/repos/cfengine/core/pulls/2257","id":38813739,"html_url":"https://github.com/cfengine/core/pull/2257","diff_url":"https://github.com/cfengine/core/pull/2257.diff","patch_url":"https://github.com/cfengine/core/pull/2257.patch","issue_url":"https://api.github.com/repos/cfengine/core/issues/2257","number":2257,"state":"closed","locked":false,"title":"Change: Improve git based release id","user":{"login":"nickanderson","id":202896,"avatar_url":"https://avatars.githubusercontent.com/u/202896?v=3","gravatar_id":"","url":"https://api.github.com/users/nickanderson","html_url":"https://github.com/nickanderson","followers_url":"https://api.github.com/users/nickanderson/followers","following_url":"https://api.github.com/users/nickanderson/following{/other_user}","gists_url":"https://api.github.com/users/nickanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/nickanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickanderson/subscriptions","organizations_url":"https://api.github.com/users/nickanderson/orgs","repos_url":"https://api.github.com/users/nickanderson/repos","events_url":"https://api.github.com/users/nickanderson/events{/privacy}","received_events_url":"https://api.github.com/users/nickanderson/received_events","type":"User","site_admin":false},"body":"Now cf-promises -T is not limited to working when you are on a checked out\r\nbranch. Now you get the commit that is checked out as the release id even if\r\nyou are checked out from a specific commit or tag.\r\n\r\nIt would be really nice if this goes into 3.7.0. I also think it should be backported to 3.6.x\r\n\r\nRef: https://dev.cfengine.com/issues/7332","created_at":"2015-06-29T20:26:45Z","updated_at":"2015-07-01T13:43:02Z","closed_at":"2015-07-01T07:08:49Z","merged_at":"2015-07-01T07:08:49Z","merge_commit_sha":"8e442b6bffbffb96af5224b7de1971d3d9cdafdc","assignee":{"login":"kacfengine","id":4037094,"avatar_url":"https://avatars.githubusercontent.com/u/4037094?v=3","gravatar_id":"","url":"https://api.github.com/users/kacfengine","html_url":"https://github.com/kacfengine","followers_url":"https://api.github.com/users/kacfengine/followers","following_url":"https://api.github.com/users/kacfengine/following{/other_user}","gists_url":"https://api.github.com/users/kacfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/kacfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacfengine/subscriptions","organizations_url":"https://api.github.com/users/kacfengine/orgs","repos_url":"https://api.github.com/users/kacfengine/repos","events_url":"https://api.github.com/users/kacfengine/events{/privacy}","received_events_url":"https://api.github.com/users/kacfengine/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/cfengine/core/pulls/2257/commits","review_comments_url":"https://api.github.com/repos/cfengine/core/pulls/2257/comments","review_comment_url":"https://api.github.com/repos/cfengine/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfengine/core/issues/2257/comments","statuses_url":"https://api.github.com/repos/cfengine/core/statuses/8754487bc51d1b5e84eec2814889373ecb656e57","head":{"label":"nickanderson:redmine/7332","ref":"redmine/7332","sha":"8754487bc51d1b5e84eec2814889373ecb656e57","user":{"login":"nickanderson","id":202896,"avatar_url":"https://avatars.githubusercontent.com/u/202896?v=3","gravatar_id":"","url":"https://api.github.com/users/nickanderson","html_url":"https://github.com/nickanderson","followers_url":"https://api.github.com/users/nickanderson/followers","following_url":"https://api.github.com/users/nickanderson/following{/other_user}","gists_url":"https://api.github.com/users/nickanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/nickanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickanderson/subscriptions","organizations_url":"https://api.github.com/users/nickanderson/orgs","repos_url":"https://api.github.com/users/nickanderson/repos","events_url":"https://api.github.com/users/nickanderson/events{/privacy}","received_events_url":"https://api.github.com/users/nickanderson/received_events","type":"User","site_admin":false},"repo":{"id":5087189,"name":"core","full_name":"nickanderson/core","owner":{"login":"nickanderson","id":202896,"avatar_url":"https://avatars.githubusercontent.com/u/202896?v=3","gravatar_id":"","url":"https://api.github.com/users/nickanderson","html_url":"https://github.com/nickanderson","followers_url":"https://api.github.com/users/nickanderson/followers","following_url":"https://api.github.com/users/nickanderson/following{/other_user}","gists_url":"https://api.github.com/users/nickanderson/gists{/gist_id}","starred_url":"https://api.github.com/users/nickanderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickanderson/subscriptions","organizations_url":"https://api.github.com/users/nickanderson/orgs","repos_url":"https://api.github.com/users/nickanderson/repos","events_url":"https://api.github.com/users/nickanderson/events{/privacy}","received_events_url":"https://api.github.com/users/nickanderson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nickanderson/core","description":"CFEngine Community","fork":true,"url":"https://api.github.com/repos/nickanderson/core","forks_url":"https://api.github.com/repos/nickanderson/core/forks","keys_url":"https://api.github.com/repos/nickanderson/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nickanderson/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nickanderson/core/teams","hooks_url":"https://api.github.com/repos/nickanderson/core/hooks","issue_events_url":"https://api.github.com/repos/nickanderson/core/issues/events{/number}","events_url":"https://api.github.com/repos/nickanderson/core/events","assignees_url":"https://api.github.com/repos/nickanderson/core/assignees{/user}","branches_url":"https://api.github.com/repos/nickanderson/core/branches{/branch}","tags_url":"https://api.github.com/repos/nickanderson/core/tags","blobs_url":"https://api.github.com/repos/nickanderson/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nickanderson/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nickanderson/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/nickanderson/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nickanderson/core/statuses/{sha}","languages_url":"https://api.github.com/repos/nickanderson/core/languages","stargazers_url":"https://api.github.com/repos/nickanderson/core/stargazers","contributors_url":"https://api.github.com/repos/nickanderson/core/contributors","subscribers_url":"https://api.github.com/repos/nickanderson/core/subscribers","subscription_url":"https://api.github.com/repos/nickanderson/core/subscription","commits_url":"https://api.github.com/repos/nickanderson/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/nickanderson/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/nickanderson/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/nickanderson/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/nickanderson/core/contents/{+path}","compare_url":"https://api.github.com/repos/nickanderson/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nickanderson/core/merges","archive_url":"https://api.github.com/repos/nickanderson/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nickanderson/core/downloads","issues_url":"https://api.github.com/repos/nickanderson/core/issues{/number}","pulls_url":"https://api.github.com/repos/nickanderson/core/pulls{/number}","milestones_url":"https://api.github.com/repos/nickanderson/core/milestones{/number}","notifications_url":"https://api.github.com/repos/nickanderson/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nickanderson/core/labels{/name}","releases_url":"https://api.github.com/repos/nickanderson/core/releases{/id}","created_at":"2012-07-17T19:52:12Z","updated_at":"2014-06-02T21:02:13Z","pushed_at":"2015-06-30T13:06:42Z","git_url":"git://github.com/nickanderson/core.git","ssh_url":"git@github.com:nickanderson/core.git","clone_url":"https://github.com/nickanderson/core.git","svn_url":"https://github.com/nickanderson/core","homepage":"https://cfengine.com/community/","size":53029,"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":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"cfengine:master","ref":"master","sha":"39b612f12960cfefc6ecd83b9134b74cfe67eefd","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-06-24T05:04:53Z","pushed_at":"2015-07-01T09:34:03Z","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":95428,"stargazers_count":220,"watchers_count":220,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":135,"mirror_url":null,"open_issues_count":15,"forks":135,"open_issues":15,"watchers":220,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfengine/core/pulls/2257"},"html":{"href":"https://github.com/cfengine/core/pull/2257"},"issue":{"href":"https://api.github.com/repos/cfengine/core/issues/2257"},"comments":{"href":"https://api.github.com/repos/cfengine/core/issues/2257/comments"},"review_comments":{"href":"https://api.github.com/repos/cfengine/core/pulls/2257/comments"},"review_comment":{"href":"https://api.github.com/repos/cfengine/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfengine/core/pulls/2257/commits"},"statuses":{"href":"https://api.github.com/repos/cfengine/core/statuses/8754487bc51d1b5e84eec2814889373ecb656e57"}}}}