{"action":"created","issue":{"url":"https://api.github.com/repos/gtramontina/ghooks/issues/69","repository_url":"https://api.github.com/repos/gtramontina/ghooks","labels_url":"https://api.github.com/repos/gtramontina/ghooks/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/gtramontina/ghooks/issues/69/comments","events_url":"https://api.github.com/repos/gtramontina/ghooks/issues/69/events","html_url":"https://github.com/gtramontina/ghooks/pull/69","id":144737138,"number":69,"title":"WIP: Support submodules & worktrees","user":{"login":"ta2edchimp","id":262436,"avatar_url":"https://avatars.githubusercontent.com/u/262436?v=3","gravatar_id":"","url":"https://api.github.com/users/ta2edchimp","html_url":"https://github.com/ta2edchimp","followers_url":"https://api.github.com/users/ta2edchimp/followers","following_url":"https://api.github.com/users/ta2edchimp/following{/other_user}","gists_url":"https://api.github.com/users/ta2edchimp/gists{/gist_id}","starred_url":"https://api.github.com/users/ta2edchimp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ta2edchimp/subscriptions","organizations_url":"https://api.github.com/users/ta2edchimp/orgs","repos_url":"https://api.github.com/users/ta2edchimp/repos","events_url":"https://api.github.com/users/ta2edchimp/events{/privacy}","received_events_url":"https://api.github.com/users/ta2edchimp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-30T22:22:35Z","updated_at":"2016-03-31T03:35:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/gtramontina/ghooks/pulls/69","html_url":"https://github.com/gtramontina/ghooks/pull/69","diff_url":"https://github.com/gtramontina/ghooks/pull/69.diff","patch_url":"https://github.com/gtramontina/ghooks/pull/69.patch"},"body":"At the moment, this PR is rather a proof and is more for the purpose to get feedback early on, as well as to keep track of the progress (and of the key ideas for me to remember when getting back on this after I had some sleep).\r\nWhen finished, this PR will address the issue #46 and probably #66 too, as their key difference to a usual git repo is identical.\r\n\r\nIn current versions of git, submodules don't have a `.git` folder in their root directory (and therefore, no `.git/hooks` folder too). Instead, they have a config file called `.git`, with something like the following content:\r\n\r\n```\r\ngitdir: ../.git/modules/submod-1\r\n```\r\n\r\nSo this is basically the pointer towards where the submodule's `hooks` directory will reside. Accordingly, I altered ghooks' `./lib/install.js` to take this into account.\r\n\r\nOn the other hand, the hooks themselves must also take their location — relative to where the package's `node_modules` directory (and therefore the `ghooks` dependency) resides — into account.\r\nMy first approach was to inject a path into the hooks' scripts upon installation, but I that felt really dirty, so I decided to take advantage of their location on the filesystem: One level upwards, will always reside a `config` file for the particular repo, containing a `worktree` setting describing where (relative to the superproject root) the submodule is located. The hooks scripts try to obtain this setting and will require the `ghooks` dependency accordingly.\r\n\r\n### This PR still lacks\r\n\r\n- [ ] Clean code according to the set up linting rules.\r\n- [ ] Thorough unit tests.\r\n\r\n### Questions\r\n\r\n1. Is there a way to make beta versions available while using `semantic-release`?\r\nI'd really like to get this tested as a real „non-RTM“ npm package by some brave users :wink: (`npm link`ing or fetching directly from a git branch simply don't suffice)."},"comment":{"url":"https://api.github.com/repos/gtramontina/ghooks/issues/comments/203736617","html_url":"https://github.com/gtramontina/ghooks/pull/69#issuecomment-203736617","issue_url":"https://api.github.com/repos/gtramontina/ghooks/issues/69","id":203736617,"user":{"login":"gtramontina","id":374635,"avatar_url":"https://avatars.githubusercontent.com/u/374635?v=3","gravatar_id":"","url":"https://api.github.com/users/gtramontina","html_url":"https://github.com/gtramontina","followers_url":"https://api.github.com/users/gtramontina/followers","following_url":"https://api.github.com/users/gtramontina/following{/other_user}","gists_url":"https://api.github.com/users/gtramontina/gists{/gist_id}","starred_url":"https://api.github.com/users/gtramontina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtramontina/subscriptions","organizations_url":"https://api.github.com/users/gtramontina/orgs","repos_url":"https://api.github.com/users/gtramontina/repos","events_url":"https://api.github.com/users/gtramontina/events{/privacy}","received_events_url":"https://api.github.com/users/gtramontina/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T03:35:29Z","updated_at":"2016-03-31T03:35:29Z","body":"One option is to use release channels. \r\n\r\n*(source: https://github.com/semantic-release/semantic-release/issues/97 and https://github.com/semantic-release/semantic-release#how-does-it-work [3rd paragraph])*"}}