Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2633: Make git hook symlinks relative. #2651

Merged
merged 1 commit into from
Mar 16, 2018

Conversation

malikkotob
Copy link
Contributor

No description provided.

@@ -217,15 +217,16 @@ public function gitHooks() {
protected function installGitHook($hook) {
if ($this->getConfigValue('git.hooks.' . $hook)) {
$this->say("Installing $hook git hook...");
$source = $this->getConfigValue('git.hooks.' . $hook) . "/$hook";
$dest = $this->getConfigValue('repo.root') . "/.git/hooks/$hook";
$bltHook = $this->getConfigValue('git.hooks.' . $hook) . "/$hook";
Copy link
Contributor

@grasmash grasmash Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessarily a BLT hook, it could be custom. Why not name it something like $hook_source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, it's a BLT hook in the sense that it's the hook that ships with BLT in it's vendor directory:

  hooks:
    pre-commit: ${blt.root}/scripts/git-hooks
    commit-msg: ${blt.root}/scripts/git-hooks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change it to $hook_source if you prefer, was thinking it was essentially a "blt provided hook"

$source = $this->getConfigValue('git.hooks.' . $hook) . "/$hook";
$dest = $this->getConfigValue('repo.root') . "/.git/hooks/$hook";
$bltHook = $this->getConfigValue('git.hooks.' . $hook) . "/$hook";
$projectHookDirectory = $this->getConfigValue('repo.root') . "/.git/hooks";
Copy link
Contributor

@grasmash grasmash Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-class property variables should be snake case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted!

@grasmash
Copy link
Contributor

Be sure to add test that asserts the symlink location is valid.

@malikkotob malikkotob force-pushed the git-hooks-fix branch 3 times, most recently from 208e2d8 to 961b23b Compare March 16, 2018 19:02
$this->assertFileExists($this->sandboxInstance . '/.git/hooks/commit-msg');
$this->assertFileExists($this->sandboxInstance . '/.git/hooks/pre-commit');
$hooks_path = $this->sandboxInstance . '/.git/hooks';
$hook_names = [
Copy link
Contributor

@grasmash grasmash Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can load this list from $this->config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

@grasmash grasmash added the Bug Something isn't working label Mar 16, 2018
@grasmash grasmash merged commit 6f3e713 into acquia:9.x Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants