-
Notifications
You must be signed in to change notification settings - Fork 395
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
Conversation
@@ -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"; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted!
Be sure to add test that asserts the symlink location is valid. |
208e2d8
to
961b23b
Compare
$this->assertFileExists($this->sandboxInstance . '/.git/hooks/commit-msg'); | ||
$this->assertFileExists($this->sandboxInstance . '/.git/hooks/pre-commit'); | ||
$hooks_path = $this->sandboxInstance . '/.git/hooks'; | ||
$hook_names = [ |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
961b23b
to
1408c81
Compare
1408c81
to
22ea59b
Compare
22ea59b
to
e35a750
Compare
No description provided.