{"action":"created","issue":{"url":"https://api.github.com/repos/nkantar/Autohook/issues/7","repository_url":"https://api.github.com/repos/nkantar/Autohook","labels_url":"https://api.github.com/repos/nkantar/Autohook/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/nkantar/Autohook/issues/7/comments","events_url":"https://api.github.com/repos/nkantar/Autohook/issues/7/events","html_url":"https://github.com/nkantar/Autohook/pull/7","id":340822503,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxMTQ0NTcw","number":7,"title":"Capture exit code of executed scripts, pass failures out as git-hook …","user":{"login":"tromech","id":5867980,"node_id":"MDQ6VXNlcjU4Njc5ODA=","avatar_url":"https://avatars0.githubusercontent.com/u/5867980?v=4","gravatar_id":"","url":"https://api.github.com/users/tromech","html_url":"https://github.com/tromech","followers_url":"https://api.github.com/users/tromech/followers","following_url":"https://api.github.com/users/tromech/following{/other_user}","gists_url":"https://api.github.com/users/tromech/gists{/gist_id}","starred_url":"https://api.github.com/users/tromech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tromech/subscriptions","organizations_url":"https://api.github.com/users/tromech/orgs","repos_url":"https://api.github.com/users/tromech/repos","events_url":"https://api.github.com/users/tromech/events{/privacy}","received_events_url":"https://api.github.com/users/tromech/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-12T22:39:07Z","updated_at":"2018-08-26T07:10:26Z","closed_at":"2018-08-26T07:10:25Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/nkantar/Autohook/pulls/7","html_url":"https://github.com/nkantar/Autohook/pull/7","diff_url":"https://github.com/nkantar/Autohook/pull/7.diff","patch_url":"https://github.com/nkantar/Autohook/pull/7.patch"},"body":"…result\r\n\r\n## Which issues are addressed?\r\n\r\nautohook.sh currently swallows exit codes of the scripts it executes, and generally terminates with exit code 0 (success). In turn, git hooks which are specified to abort on failures (exit code != 0) never will actually abort.\r\n\r\n## What's implemented?\r\n\r\nIf one or more of the scripts linked for a hook-type result in a negative (!= 0) exit code, that exit code will define the exit code of the whole hook (i.e. of the autohook.sh) invocation. By that way, a hook such as pre-commit is able to be aborted in case one of the sub-scripts defined via autohook fails.  \r\n\r\n\r\n## Why this implementation?\r\n\r\nMaking sure to not swallow exit codes is crucial to maintain the basic functionality of git hooks, specifically for the pre-xxx hooks which should allow to act as a safeguard / prevent some operation. \r\n\r\nEither way, with this implementation, all of the sub-scripts for a hook-type still get executed, even if one has already failed at start. It would be possible to already abort on first failure instead though - however, since some of the hooks aren't even supposed to abort (post-xxx), IMO it's more consistent to still execute them all and only determine an appropriate total exit status as global result. \r\n\r\n## Any caveats?\r\n\r\nIn case there are multiple scripts for a hook type which fail, only one of their exit codes (the last one) will be used as exit code.  \r\n\r\n\r\n## Any additional notes?\r\n\r\n\r\n\r\n## Checklist\r\n\r\n- [ ] Everything works.\r\n- [ ] Test are present and pass.\r\n- [ ] Documentation has been updated.\r\n"},"comment":{"url":"https://api.github.com/repos/nkantar/Autohook/issues/comments/416019025","html_url":"https://github.com/nkantar/Autohook/pull/7#issuecomment-416019025","issue_url":"https://api.github.com/repos/nkantar/Autohook/issues/7","id":416019025,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjAxOTAyNQ==","user":{"login":"nkantar","id":568543,"node_id":"MDQ6VXNlcjU2ODU0Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/568543?v=4","gravatar_id":"","url":"https://api.github.com/users/nkantar","html_url":"https://github.com/nkantar","followers_url":"https://api.github.com/users/nkantar/followers","following_url":"https://api.github.com/users/nkantar/following{/other_user}","gists_url":"https://api.github.com/users/nkantar/gists{/gist_id}","starred_url":"https://api.github.com/users/nkantar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkantar/subscriptions","organizations_url":"https://api.github.com/users/nkantar/orgs","repos_url":"https://api.github.com/users/nkantar/repos","events_url":"https://api.github.com/users/nkantar/events{/privacy}","received_events_url":"https://api.github.com/users/nkantar/received_events","type":"User","site_admin":false},"created_at":"2018-08-26T07:10:26Z","updated_at":"2018-08-26T07:10:26Z","author_association":"OWNER","body":"This definitely looks useful for the current version, thanks!"}}
{"actor":{"display_login":"nkantar"}}